<?php
/* *
* $Author ：PHPYUN开发团队
*
* 官网: http://www.phpyun.com
*
* 版权所有 2009-2018 宿迁鑫潮信息技术有限公司，并保留所有权利。
*
* 软件声明：未经授权前提下，不得用于商业运营、二次开发以及任何形式的再次发布。
*/
class index_controller extends wxapp_controller{
	/*wxapp个人首页*/
	function getuser_action(){
	    $uid=(int)$_POST['uid'];
	    //记录登录日志
	    $this->login_log($uid);
	    $member = $this->obj->DB_select_once("member","`uid`='".$uid."'");
	    $resume = $this->obj->DB_select_once("resume","`uid`='".$uid."'");
	    $data['name']=$resume['name'];
	    $data['username']=$member['username'];
	    $data['moblie']=$resume['telphone'];
	    $data['moblie_status']=$resume['moblie_status'];
	    $data['email']=$resume['email'];
	    $data['email_status']=$resume['email_status'];
	    $data['idcard_pic']=$resume['idcard_pic'];
	    $data['idcard_status']=$resume['idcard_status'];
	    if($resume['photo'] && (file_exists(str_replace('./',APP_PATH,$resume['photo'])))){
	        $data['small_photo']   =str_replace("./",$this->config['sy_weburl']."/",$resume['photo']);
	    }else{
	        if($resume['sex']==1){
	            $data['small_photo'] =$this->config['sy_weburl'].'/'.$this->config['sy_member_icon'];
	        }else{
	            $data['small_photo'] =$this->config['sy_weburl'].'/'.$this->config['sy_member_iconv'];
	        }
	    }
	    $userid_msg=$this->obj->DB_select_num("userid_msg","`uid`='".$uid."'");
	    $sq_jobnum=$this->obj->DB_select_num("userid_job","`uid`='".$uid."'");
	    $fav_jobnum=$this->obj->DB_select_num("fav_job","`uid`='".$uid."'");
	    $wkyqnum=$this->obj->DB_select_num("userid_msg","`uid`='".$uid."' and `is_browse`='1'");
	    $sxrowsnum=$this->obj->DB_select_num("sysmsg","`fa_uid`='".$uid."'and `remind_status`='0'");
	    $data['msgnum']=$wkyqnum+$sxrowsnum;
	    $data['userid_msg']=$userid_msg;
	    $data['sq_jobnum']=$sq_jobnum;
	    $data['fav_jobnum']=$fav_jobnum;
	    $data['error']=1;
	    echo json_encode($data);die;
	}
	/*wxapp基本信息页面显示、创建简历页面显示*/
	function getinfo_action(){
		if(!$_POST['uid']){
			$data['error']=3;
			echo json_encode($data);die;
		}
		$uid=(int)$_POST['uid'];
		$row = $this->obj->DB_select_once("resume","`uid`='".$uid."'");
		if((!is_array($row) || empty($row)) && $_POST['uid']){
			$data['error']=2;
			echo json_encode($data);die;
		}
		include(PLUS_PATH."user.cache.php");
		include(CONFIG_PATH."db.data.php");
		$data['uid']		=$row['uid'];
		$data['name']		=$row['name'];
		$data['sex']		=$row['sex'];
		$data['sex_n']		=$arr_data['sex'][$row['sex']];
		$data['birthday']	=$row['birthday'];
		$data['telphone']	=$row['telphone'];
		$data['email']		=$row['email'];
		$data['edu']		=$row['edu'];
		$data['edu_n']		=$userclass_name[$row['edu']];
		$data['address']	=$row['address'];
		$data['living']	    =$row['living'];
		$data['description']=$row['description'];
		$data['expect']		=$row['expect'];
		$data['def_job']	=$row['def_job'];
		$data['exp']		=$row['exp'];
		$data['exp_n']		=$userclass_name[$row['exp']];
		$data['status']		=$row['status'];
		$data['qq']	=$row['qq'];
		if($row['wxewm'] && (file_exists(str_replace('./',APP_PATH,$row['wxewm'])))){
		    $data['wxewm']   =str_replace("./",$this->config['sy_weburl']."/",$row['wxewm']);
		}
// 		if($row['resume_photo'] && (file_exists(str_replace('./',APP_PATH,$row['resume_photo'])))){
// 		    $data['resume_photo']=str_replace("./",$this->config['sy_weburl']."/",$row['resume_photo']);
// 		}else{
// 		    if($row['sex']==1){
// 		        $data['resume_photo']=$this->config['sy_weburl'].'/'.$this->config['sy_member_icon'];
// 		    }else{
// 		        $data['resume_photo']=$this->config['sy_weburl'].'/'.$this->config['sy_member_iconv'];
// 		    }
// 		}
// 		if($row['photo'] && (file_exists(str_replace('./',APP_PATH,$row['photo'])))){
// 		    $data['photo']=str_replace("./",$this->config['sy_weburl']."/",$row['photo']);
// 		}else{
// 		    if($row['sex']==1){
// 		        $data['photo']=$this->config['sy_weburl'].'/'.$this->config['sy_member_icon'];
// 		    }else{
// 		        $data['photo']=$this->config['sy_weburl'].'/'.$this->config['sy_member_iconv'];
// 		    }
// 		}
// 		$data['telhome']	=$row['telhome'];
// 		$data['homepage']	=$row['homepage']?$row['homepage']:''.'';
// 		$data['marriage']	=$row['marriage'];
// 		$data['height']		=((float)$row['height']).'';
// 		$data['nationality']=$row['nationality'];
// 		$data['weight']		=((float)$row['weight']).'';
// 		$data['domicile']	=$row['domicile'];
// 		$data['idcard']		=$row['idcard'];
// 		$data['idcard_pic']	=$row['idcard_pic'];
// 		$data['idcard_status']=$row['idcard_status'];
// 		$data['statusbody']	=$row['statusbody'];
// 		$data['cert_time']	=$row['cert_time'];
// 		$data['r_status']	=$row['r_status'];
// 		$data['ant_num']	=$row['ant_num'];
// 		$data['email_dy']	=$row['email_dy'];
// 		$data['msg_dy']		=$row['msg_dy'];
		$data['resume_create_exp'] = $this->config['resume_create_exp'];
		$data['resume_create_edu'] = $this->config['resume_create_edu'];
		$data['resume_create_project'] = $this->config['resume_create_project'];
		$data['error']=1;
		echo json_encode($data);die;
	}
	//简历管理
	function resume_action(){
	    include(CONFIG_PATH."db.data.php");
	    unset($arr_data['sex'][3]);
	    $CacheArr=$this->MODEL('cache')->GetCache(array('city','user','hy','job'));
	    
	    $user=$this->obj->DB_select_once("resume","`uid`='".$_POST['uid']."'");
	    if($user['birthday']){
	        $a=date('Y',strtotime($user['birthday']));
	        $userData['age']=date("Y")-$a;
	    }
	    if($user['tag']){
	        $tag = @explode(',',$user['tag']);
	    }
	    $userData['id']=$user['id'];
	    $userData['arrayTag']=$tag;
	    $userData['name']=$user['name'];
	    $userData['sex']=$arr_data['sex'][$user['sex']];
	    $userData['exp']=$CacheArr['userclass_name'][$user['exp']];
	    $userData['edu']=$CacheArr['userclass_name'][$user['edu']];
	    $userData['living']=$user['living'];
	    $userData['description']=$user['description'];
	    if($user['photo'] && (file_exists(str_replace('./',APP_PATH,$user['photo'])))){
	        $userData['small_photo']   =str_replace("./",$this->config['sy_weburl']."/",$user['photo']);
	    }else{
	        if($user['sex']==1){
	            $userData['small_photo'] =$this->config['sy_weburl'].'/'.$this->config['sy_member_icon'];
	        }else{
	            $userData['small_photo'] =$this->config['sy_weburl'].'/'.$this->config['sy_member_iconv'];
	        }
	    }
	    $data['user']=$userData;
	    //名下简历
	    $expects = $this->obj->DB_select_all('resume_expect','`uid`='.$_POST['uid'].'','`id`,`name`,`defaults`');
	    if ($expects){
	        $elist=array();
	        foreach ($expects as $k=>$v){
	            $elist['id'][]=$v['id'];
	            if($v['defaults']==1){
	                $elist['name'][]=$v['name'].'(默认)';
	            }else{
	                $elist['name'][]=$v['name'];
	            }
	        }
	        $data['elist']=$elist;
	    }else{
	        $data['elist']=array();
	    }
	    if ($_POST['eid']!=''){
	        $eid = $_POST['eid'];
	    }else{
	        $eid = $user['def_job'];
	    }
	    if ($eid){
	        $expect=$this->obj->DB_select_once("resume_expect","`uid`='".$_POST['uid']."' and `id`='".$eid."'");
	    }else{
	        $expect=$this->obj->DB_select_once("resume_expect","`uid`='".$_POST['uid']."'");
	    }
	    if($expect){
	        $expectData['id']=$expect['id'];
	        $expectData['name']=$expect['name'];
	        $expectData['integrity']=$expect['integrity'];
	        $expectData['hits']=$expect['hits'];
	        $expectData['defaults']=$expect['defaults'];
	        $expectData['status']=$expect['status'];
	        if($expect['r_status']==0){
	            $expectData['r_status']='待审核';
	        }else if($expect['r_status']==1){
	            $expectData['r_status']='已审核';
	        }else if($expect['r_status']==3){
	            $expectData['r_status']='未通过审核';
	        }
	        $expectData['lastupdate']=date('Y-m-d',$expect['lastupdate']);
	        if($expect['minsalary']&&$expect['maxsalary']){
	            $expectData['salary'] = $expect['minsalary']."-".$expect['maxsalary']."元/月";
	        }elseif($expect['minsalary']){
	            $expectData['salary'] = $expect['minsalary']."元/月";
	        }else{
	            $expectData['salary'] = "面议";
	        }
	        $expectData['hy']=$CacheArr['industry_name'][$expect['hy']];
	        $expectData['exp']=$CacheArr['userclass_name'][$expect['exp']];
	        $expectData['edu']=$CacheArr['userclass_name'][$expect['edu']];
	        $expectData['report']=$CacheArr['userclass_name'][$expect['report']];
	        $expectData['type']=$CacheArr['userclass_name'][$expect['type']];
	        $expectData['jobstatus']=$CacheArr['userclass_name'][$expect['jobstatus']];
	        if($expect['job_classid']){
	            $job_classid=@explode(',',$expect['job_classid']);
	            $jobname=array();
	            foreach($job_classid as $val){
	                $jobname[]=$CacheArr['job_name'][$val];
	            }
	            $expectData['jobname']=@implode(' ',$jobname);
	        }
	        if($expect['city_classid']){
	            $city_classid=@explode(',',$expect['city_classid']);
	            $cityname=array();
	            foreach($city_classid as $val){
	                $cityname[]=$CacheArr['city_name'][$val];
	            }
	            $expectData['cityname']=@implode(' ',$cityname);
	        }
	        $data['expect']=$expectData;
	    }
	    //工作经历
	    $work=$this->obj->DB_select_all("resume_work","`uid`='".$_POST['uid']."' and `eid`='".$expect['id']."' order by `sdate` desc");
	    foreach($work as $wk=>$wv){
	        $workData[$wk]['title']=$wv['title'];
	        $workData[$wk]['name']=$wv['name'];
	        $workData[$wk]['content']=$wv['content'];
	        $workData[$wk]['sdate']=date('Y-m',$wv['sdate']);
	        if($wv['edate']!=0){
	            $workData[$wk]['edate']=date('Y-m',$wv['edate']);
	            $workData[$wk]['date_n']=$workData[$wk]['sdate'].'-'.$workData[$wk]['edate'];
	        }else{
	            $workData[$wk]['date_n']=$workData[$wk]['sdate'].'至今';
	        }
	    }
	    $data['work']=$workData;
	    //教育经历
	    $edu=$this->obj->DB_select_all("resume_edu","`uid`='".$_POST['uid']."' and `eid`='".$expect['id']."' order by `sdate` desc");
	    foreach($edu as $ek=>$ev){
	        $eduData[$ek]['title']=$ev['title'];
	        $eduData[$ek]['name']=$ev['name'];
	        $eduData[$ek]['education']=$CacheArr['userclass_name'][$ev['education']];
	        $eduData[$ek]['specialty']=$ev['specialty'];
	        $eduData[$ek]['sdate']=date('Y-m',$ev['sdate']);
	        $eduData[$ek]['edate']=date('Y-m',$ev['edate']);
	        $eduData[$ek]['date_n']=$eduData[$ek]['sdate'].'-'.$eduData[$ek]['edate'];
	        
	    }
	    $data['edu']=$eduData;
	    //项目经历
	    $project=$this->obj->DB_select_all("resume_project","`uid`='".$_POST['uid']."' and `eid`='".$expect['id']."' order by `sdate` desc");
	    foreach ($project as $k=>$v){
	        $projectData[$k]['name']=$v['name'];
	        $projectData[$k]['title']=$v['title'];
	        $projectData[$k]['content']=$v['content'];
	        if ($v['edate']!=0){
	            $projectData[$k]['date']=date('Y.m',$v['sdate']).'-'.date('Y.m',$v['edate']);
	        }else{
	            $projectData[$k]['date']=date('Y.m',$v['sdate']).'-至今';
	        }
	    }
	    $data['project']=$projectData;
	    //培训经历
	    $training=$this->obj->DB_select_all("resume_training","`uid`='".$_POST['uid']."' and `eid`='".$expect['id']."' order by `sdate` desc");
	    foreach($training as $tk=>$tv){
	        $trainingData[$tk]['title']=$tv['title'];
	        $trainingData[$tk]['name']=$tv['name'];
	        $trainingData[$tk]['content']=$tv['content'];
	        $trainingData[$tk]['sdate']=date('Y-m',$tv['sdate']);
	        if($wv['edate']!=0){
	            $trainingData[$tk]['edate']=date('Y-m',$tv['edate']);
	            $trainingData[$tk]['date_n']=$trainingData[$tk]['sdate'].'-'.$trainingData[$tk]['edate'];
	        }else{
	            $trainingData[$tk]['date_n']=$trainingData[$tk]['sdate'].'至今';
	        }
	    }
	    $data['training']=$trainingData;
	    //职业技能
	    $skill=$this->obj->DB_select_all("resume_skill","`uid`='".$_POST['uid']."' and `eid`='".$expect['id']."' order by `id` desc");
	    foreach($skill as $sk=>$sv){
	        $skillData[$sk]['name']=$sv['name'];
	        $skillData[$sk]['longtime']=$sv['longtime'];
	        if($sv['pic'] &&file_exists(str_replace('./',APP_PATH,$sv['pic']))){
	            $skillData[$sk]['pic']=str_replace("./",$this->config['sy_weburl']."/",$sv['pic']);
	        }else{
	            $skillData[$sk]['pic']='';
	        }
	    }
	    $data['skill']=$skillData;
	    //其他信息
	    $other=$this->obj->DB_select_all("resume_other","`uid`='".$_POST['uid']."' and `eid`='".$expect['id']."' order by `id` desc");
	    foreach ($other as $k=>$v){
	        $otherData[$k]['name']=$v['name'];
	        $otherData[$k]['content']=$v['content'];
	    }
	    $data['other']=$otherData;
	    $resume=$this->obj->DB_select_once("user_resume","`eid`='".$expect['id']."'");
	    $data['resume']=$resume;
	    echo json_encode($data);die;
	}
	function isaddresume_action(){
	    $uid=intval($_POST['uid']);
	    $expects = $this->obj->DB_select_num('resume_expect','`uid`='.$uid.'');
	    if ($this->config['user_number']>0 && $this->config['user_number']<=$expects){
	        $this->errjson('您的简历数已经达到系统设置的最大简历数',10);
	    }else{
	        $this->errjson('可以创建简历',0);
	    }
	}
	/*wxapp简历修改页面显示*/
	function expectedit_action(){
		if(!$_POST['eid'] && !$_POST['uid']){
			$data['error']=3;
			$data['msg']="参数不正确！";
			echo json_encode($data);die;
		}else{
			include(PLUS_PATH."user.cache.php");
			include(PLUS_PATH."industry.cache.php");
			include(PLUS_PATH."city.cache.php");
			include(PLUS_PATH."job.cache.php");
			$expect=$this->obj->DB_select_once("resume_expect","`uid`='".$_POST['uid']."' and `id`='".(int)$_POST['eid']."'");
			if($expect['id']){
			    $data['id']	=$expect['id'];
			    $data['name']=$expect['name'];
				$data['hy']	=$expect['hy'];
				$data['hy_n']	=$industry_name[$expect['hy']];
				$data['type']	=$expect['type'];
				$data['type_n']	=$userclass_name[$expect['type']];
				$data['report']	=$expect['report'];
				$data['report_n']	=$userclass_name[$expect['report']];
				$data['jobstatus']	=$expect['jobstatus'];
				$data['jobstatus_n']	=$userclass_name[$expect['jobstatus']];
				$data['minsalary']	=$expect['minsalary'];
				$data['maxsalary']	=$expect['maxsalary'];
				$data['jobclassid']	=$expect['job_classid'];
				$data['cityclassid']=$expect['city_classid'];
				if($expect['job_classid']){
					$job_classid=@explode(',',$expect['job_classid']);
					$jobname=array();
					foreach($job_classid as $val){
						$jobname[]=$job_name[$val];
					}
				}
				if($expect['city_classid']){
				    $city_classid=@explode(',',$expect['city_classid']);
				    $cityname=array();
				    foreach($city_classid as $val){
				        $cityname[]=$city_name[$val];
				    }
				}
				$data['cityname']	=@implode(',',$cityname);
				$data['jobname']	=@implode(',',$jobname);
				
			}else{
				$data['error']=3;
				$data['msg']="参数不正确！";
			}
		}
		foreach($data as $k=>$v){
			if(is_array($v)){
				foreach($v as $key=>$val){
					$data[$k][$key]=isset($val)?$val.'':'';
				}
			}else{
				$data[$k]=isset($v)?$v.'':'';
			}
		}
		$data['error']=1;
		echo json_encode($data);die;
	}
	function rinfo_action(){
		if(!$_POST['eid'] && !$_POST['uid']){
			$data['error']=3;
			$data['msg']="参数不正确！";
			echo json_encode($data);die;
		}else{
			include(PLUS_PATH."user.cache.php");
			$rows=$this->obj->DB_select_all("resume_".$_POST['table'],"`eid`='".(int)$_POST['eid']."' and `uid`='".$_POST['uid']."'");
			foreach($rows as $k=>$v){
				$list[$k]['eid']	=$v['eid'];
				$list[$k]['id']	=$v['id'];
				$list[$k]['name']	=$v['name'];
				$list[$k]['title']	=$v['title'];
				$list[$k]['content']	=$v['content'];
				$list[$k]['longtime']	=$v['longtime'];
				$list[$k]['specialty']	=$v['specialty'];
				if($v['sdate']){
					$list[$k]['sdate_n']	=date('Y-m-d',$v['sdate']);
				}
				if($v['edate']){
					$list[$k]['edate_n']	=date('Y-m-d',$v['edate']);
				}
				if($v['education']){
					$list[$k]['edu_n']=$userclass_name[$v['education']];
				}
				if($v['pic'] && (file_exists(str_replace('./',APP_PATH,$v['pic'])))){
					$list[$k]['pic']   =str_replace("./",$this->config['sy_weburl']."/",$v['pic']);
				}
			}

			foreach($list as $k=>$v){
				if(is_array($v)){
					foreach($v as $key=>$val){
						$list[$k][$key]=isset($val)?$val:'';
					}
				}else{
					$list[$k]=isset($v)?$v:'';
				}
			}
			$data['list']=count($list)?$list:array();
		}

		echo json_encode($data);die;
	}
	/*wxapp工作经历、培训经历。。。修改页面*/
	function addresumeson_action(){
		if($_POST['table']=="desc"){
			$desc=$this->obj->DB_select_once("resume","`uid`='".$_POST['uid']."'","`description`,`tag`");
			$data['description']=$desc['description'];
			if($desc['tag']){
			    $tag= @explode(',',$desc['tag']);
			}
			//现有的标签
			$data['tag']=$tag?$tag:array();
			//系统的标签
			include(PLUS_PATH."user.cache.php");
			foreach ($userdata['user_tag'] as $v){
			    if(!in_array($userclass_name[$v], $tag) && $userclass_name[$v]){
			        $usertag[] = $userclass_name[$v];
			    }
			}
			$data['usertag']=$usertag?$usertag:array();
		}
		if($_POST['id'] && $_POST['table']){
			include(PLUS_PATH."user.cache.php");
			$row=$this->obj->DB_select_once("resume_".$_POST['table'],"`id`='".(int)$_POST['id']."' and `uid`='".$_POST['uid']."'");
			$data['id']=$_POST['id'];
			$row['sdate_n']=date('Y-m-d',$row['sdate']);
			if($row['edate']){
				$row['edate_n']=date('Y-m-d',$row['edate']);
			}
			if($row['education']){
				$row['edu_n']=$userclass_name[$row['education']];
			}
			if($row['pic'] && (file_exists(str_replace('./',APP_PATH,$row['pic'])))){
				$row['pic']   =str_replace("./",$this->config['sy_weburl']."/",$row['pic']);
			}
			foreach($row as $k=>$v){
				$data[$k]=$v;
			}
		} 
		foreach($data as $k=>$v){
			if(is_array($v)){
				foreach($v as $key=>$val){
					$data[$k][$key]=isset($val)?$val.'':'';
				}
			}else{
				$data[$k]=isset($v)?$v.'':'';
			}
		}
		$data['error']=1;
		echo json_encode($data);die;
	}
	/*wxapp保创建简历保存*/
	function saveaddresume_action(){
	    $_POST=$this->post_trim($_POST);
	    if(!$_POST['name']||!$_POST['sex']||!$_POST['birthday']||!$_POST['edu']||!$_POST['exp']||!$_POST['telphone']||!$_POST['uid']||!$_POST['realname']){
			$data['error']=3;
			$data['msg']='请完善信息！';
			echo json_encode($data);die;
		}else{
		    $uid=(int)$_POST['uid'];
		    $time=time();
		    $resumeM=$this->MODEL('resume');
		    $row=$this->obj->DB_select_once("resume","`uid`='".$uid."'");
			if($row['moblie_status']!=1){
			    $mobile=$this->obj->DB_select_num("member","`uid`<>'".$uid."' and `moblie`='".$_POST['telphone']."'","`uid`");
				if($mobile>0){
					$data['error']=3;
					$data['msg']='手机已存在！';
					echo json_encode($data);die;
				}else{
					$mvalue['moblie']=$_POST['telphone'];
				}
			}
			if($row['email_status']!=1&&!empty($_POST['email'])){
				$email=$this->obj->DB_select_num("member","`uid`<>'".$uid."' and `email`='".$_POST['email']."'","`uid`");
				if($email>0){
					$data['error']=3;
					$data['msg']='邮箱已存在！';
					echo json_encode($data);die;
				}else{
					$mvalue['email']=$_POST['email'];
				}
			}else{
				$mvalue['email']=$_POST['email'];
			}
			delfiledir("../data/upload/tel/".$uid);
			$where['uid']=$uid;
			$infoDate = array(
				"name"		=>	$this->stringfilter($_POST['realname']),
				"sex"		=>	$this->stringfilter($_POST['sex']),
				"birthday"	=>	$this->stringfilter($_POST['birthday']),
				"edu"		=>	$this->stringfilter($_POST['edu']),
				"exp"		=>	$this->stringfilter($_POST['exp']),
				"living"	=>	$this->stringfilter($_POST['living']),
			    "lastupdate"=>  $time
			);

			if($row['moblie_status']!=1){
				$infoDate['telphone']=$_POST['telphone'];
				$mvalue['moblie']=$_POST['telphone'];
			}
			if($row['email_status']!=1){
				$infoDate['email']=$_POST['email'];
				$mvalue['email']=$_POST['email'];
			}
			$this->obj->update_once('resume',$infoDate,$where);
			if(!empty($mvalue)){
				$this->obj->update_once('member',$mvalue,$where);
			}
			unset($where);
			//if(!preg_match("/^[0-9,]+$/",$_POST['classid'])){
			//	unset($_POST['classid']);
			//}
			$num=$this->obj->DB_select_num("resume_expect","`uid`='".$uid."'");
			$integrity = 55;
			$expectDate = array(
			    "lastupdate"	=>	$time,
				"height_status"	=>	0,
				"uid"			=>	$uid,
				"defaults"		=>	$num<=0?1:0,
			    "ctime"			=>	$time,
				"name"			=>	$this->stringfilter($_POST['name']),
				"hy"			=>	$_POST['hy'],
				"job_classid"	=>	$_POST['jobclassid'],
				"minsalary"		=>	$_POST['minsalary'],
				"maxsalary"		=>	$_POST['maxsalary'],
				"city_classid"	=>	$_POST['cityclassid'],
				"type"			=>	$_POST['type'],
				"report"		=>	$_POST['report'],
				"jobstatus"		=>	$_POST['jobstatus'],
			    "integrity"		=>	$integrity,
			    "source"		=>  13,
			    "sex"			=>	$this->stringfilter($_POST['sex']),
			    "birthday"		=>	$this->stringfilter($_POST['birthday']),
			    "edu"			=>	$this->stringfilter($_POST['edu']),
			    "exp"			=>	$this->stringfilter($_POST['exp']),
			    "uname"         =>  $this->stringfilter($_POST['realname'])
			);
			$nid=$this->obj->insert_into("resume_expect",$expectDate);

			delfiledir("../data/upload/tel/".$expectDate['uid']);
			$where['uid']=$expectDate['uid'];
			$where['id']=$nid;
			if ($nid){//创建一条简历
			    //处理简历选择多城市、多职位
			    $resumeM->addCityclass($nid,$uid,$expectDate['city_classid']);
			    $resumeM->addJobclass($nid,$uid,$expectDate['job_classid']);
				if($num==0){//设置默认简历
					//创建首份简历送微信红包
				    $this->sendredpack(array('type'=>'3','uid'=>$uid));
				    $this->obj->update_once('resume',array('def_job'=>$nid,'resumetime'=>$time),array('uid'=>$uid));
				}else{
				    $this->obj->update_once('resume',array('resumetime'=>$time),array('uid'=>$uid));
                }
				$resume_num=$num+1;
				$data1['uid'] = $uid;
				$data1['eid'] = $nid;
				$data1['expect'] ='1';
				$this->obj->insert_into("user_resume",$data1);
				$this->obj->DB_update_all('member_statis',"`resume_num`='".$resume_num."'","`uid`='".$uid."'");
				$state_content = "发布了 <a href=\"".Url("resume",array("c"=>"show","id"=>$nid))."\" target=\"_blank\">新简历</a>。";
				$fdata['uid']	  = $uid;
				$fdata['content'] = $state_content;
				$fdata['ctime']   = $time;
				$fdata['type']   = 2;
				$this->obj->insert_into("friend_state",$fdata);
				$this->member_log("创建一份简历", $uid, 1, 2, 1);

				$IntegralM=$this->MODEL('integral');

        		if($row['name']==""||$row['living']==""){
        		    $IntegralM->company_invtal($uid,$this->config['integral_userinfo'],true,"首次填写基本资料",true,2,'integral',25);
				} 
				$num=$this->obj->DB_select_num("company_pay","`com_id`='".$uid."' AND `pay_remark`='发布简历'");
				if($num<1){
				    $IntegralM->get_integral_action($uid,"integral_add_resume","发布简历");
				}
				$Warning=$this->MODEL("warning");
				$Warning->warning("3");
				$resume = $this->obj->DB_select_once("resume","`uid`='".$uid."'","`name`,`edu`,`exp`,`sex`,`birthday`,`idcard_status`,`status`,`r_status`,`photo`");

				$this->obj->update_once("resume_expect",array(
						"idcard_status"=>$resume['idcard_status'],
						"status"=>$resume['status'],
						"r_status"=>$this->config['resume_status'],
						"photo"=>$resume['photo']
				),$where);
				if ($this->config['resume_create_exp']==1){
				    $integrity +=10;
				    $work['uid'] = $uid;
				    $work['eid'] = $nid;
				    $work['name'] =  $_POST['workname'];
				    $work['sdate'] =  strtotime($_POST['worksdate']);
				    $work['edate'] =  $_POST['workedate']!=''?strtotime($_POST['workedate']):0;
				    $work['title'] =  $_POST['worktitle'];
				    $work['content'] =  $_POST['workcontent'];
				    $this->obj->insert_into('resume_work',$work);
				    $this->obj->update_once('resume_expect',array('integrity'=>$integrity),array('uid'=>$uid,'id'=>$nid));
				    $this->obj->update_once('user_resume',array('work'=>1),array('uid'=>$uid,'eid'=>$nid));
				}
				if ($this->config['resume_create_edu']==1){
				    $integrity +=10;
				    $edu['uid'] = $uid;
				    $edu['eid'] = $nid;
				    $edu['name'] =  $_POST['eduname'];
				    $edu['sdate'] =  strtotime($_POST['edusdate']);
				    $edu['edate'] =  strtotime($_POST['eduedate']);
				    $edu['specialty'] =  $_POST['specialty'];
				    $edu['education'] =  $_POST['eduid'];
				    $this->obj->insert_into('resume_edu',$edu);
				    $this->obj->update_once('resume_expect',array('integrity'=>$integrity),array('uid'=>$uid,'id'=>$nid));
				    $this->obj->update_once('user_resume',array('edu'=>1),array('uid'=>$uid,'eid'=>$nid));
				}
				if ($this->config['resume_create_project']==1){
				    $integrity +=8;
				    $project['uid'] = $uid;
				    $project['eid'] = $nid;
				    $project['name'] =  $_POST['projectname'];
				    $project['sdate'] =  strtotime($_POST['projectsdate']);
				    $project['edate'] =  strtotime($_POST['projectedate']);
				    $project['title'] =  $_POST['projecttitle'];
				    $project['content'] =  $_POST['projectcontent'];
				    $this->obj->insert_into('resume_project',$project);
				    $this->obj->update_once('resume_expect',array('integrity'=>$integrity),array('uid'=>$uid,'id'=>$nid));
				    $this->obj->update_once('user_resume',array('project'=>1),array('uid'=>$uid,'eid'=>$nid));
				}
				$data['eid'] = $nid;
				$data['error']=1;
				$data['msg']='简历创建成功！';
			}else{
				$data['error']=2;
				$data['msg']='简历创建失败！';
			}
		}
		echo json_encode($data);die;
	}
	function saveexpect_action(){
	    $_POST=$this->post_trim($_POST);
		if(!$_POST['hy']||!$_POST['city_classid']||!$_POST['uid']){
			$data['error']=3;
			$data['msg']='请完善信息！！';
			echo json_encode($data);die;
		}else{
			$eid=(int)$_POST['eid'];
			$uid=(int)$_POST['uid'];
			$time=time();
			$where['id']=$eid;
			$where['uid']=$uid;
			$expectData['name'] = $_POST['name'];
			$expectData['hy'] = $_POST['hy'];
			$expectData['job_classid'] = $_POST['job_classid'];
			$expectData['city_classid'] = $_POST['city_classid'];
			$expectData['jobstatus'] = $_POST['jobstatus'];
			$expectData['type'] = $_POST['type'];
			$expectData['report'] = $_POST['report'];
			$expectData['minsalary'] = $_POST['minsalary'];
			$expectData['maxsalary'] = $_POST['maxsalary'];
			$expectData['lastupdate']=$time;
			$expectData['height_status']="0";
			$resumeM=$this->MODEL('resume');
			$brforeresume=$resumeM->SelectExpectOne(array('id'=>$eid),'`job_classid`,`city_classid`');
			$nid=$resumeM->UpdateResumeExpect($expectData,$where);
			$resumeM->UpdateUserResume(array('expect'=>1),array('eid'=>$eid,'uid'=>$uid));
			if($nid){
			    $this->member_log('修改简历', $uid, 1);
			    $resumeM->UpdateResume(array('lastupdate'=>$time),array('uid'=>$uid));
			    //判断简历多职位和多城市选择，有变化才进行更新操作
			    if ($brforeresume){
			        $jobnochange=$citynochange=0;
			        if($brforeresume['city_classid']==''){
			            $citynochange=1;
			        }else{
			            $beforecity = @explode(',', $brforeresume['city_classid']);
			            $nowcity = @explode(',', $_POST['city_classid']);
			            if(array_diff($beforecity,$nowcity) || array_diff($nowcity,$beforecity)){
			                $citynochange=1;
			            }
			        }
			        if($citynochange==1){
			            $resumeM->delCityclass(array('eid'=>$eid));
			            $return=$resumeM->addCityclass($eid,$uid,$_POST['city_classid']);
			        }
			        if($brforeresume['job_classid']==''){
			            $jobnochange=1;
			        }else{
			            $beforejob = @explode(',', $brforeresume['job_classid']);
			            $nowjob = @explode(',', $_POST['job_classid']);
			            if(array_diff($beforejob,$nowjob) || array_diff($nowjob,$beforejob)){
			                $jobnochange=1;
			            }
			        }
			        if($jobnochange==1){
			            $resumeM->delJobclass(array('eid'=>$eid));
			            $resumeM->addJobClass($eid,$uid,$_POST['job_classid']);
			        }
			    }
			    $data['error']=1;
			    $data['msg']='修改成功，继续完善！';
			}else{
			    $data['error']=2;
			    $data['msg']='修改失败！';
			}
			echo json_encode($data);die;
		}
	}
	function saveskill_action(){
		$this->resume("resume_skill","skill");
	}
	function savework_action(){
		$this->resume("resume_work","work");
	}
	function saveproject_action(){
		$this->resume("resume_project","project");
	}
	function saveedu_action(){
		$this->resume("resume_edu","edu");
	}
	function savetraining_action(){
		$this->resume("resume_training","training");
	}
	function savecert_action(){
		$this->resume("resume_cert","cert");
	}
	function saveother_action(){
		$this->resume("resume_other","other");
	}
	function savedesc_action(){
	    $_POST=$this->post_trim($_POST);
		if(!$_POST['description']){
			$data['error']=3;
			$data['msg']='请完善信息！';
			echo json_encode($data);die;
		}else{
			$_POST['description']=$this->stringfilter($_POST['description']);
			$_POST['tag']=$this->stringfilter($_POST['tag']);
			$id=$this->obj->DB_update_all("resume","`tag`='".$_POST['tag']."',`description`='".$_POST['description']."' , `lastupdate`='".time()."'","`uid`='".$_POST['uid']."'");
			if($id){
				$data['error']=1;
				$data['msg']="保存成功！";
			}else{
				$data['error']=1;
				$data['msg']="保存失败！";
			}
			echo json_encode($data);die;
		}
	}
	function resume($table,$url){
	    $_POST=$this->post_trim($_POST);
	    if(!$_POST['name']){
	        $data['error']=3;
	        $data['msg']='请完善信息！';
	        echo json_encode($data);die;
	    }
	    //$_POST = $this->CheckAppUser();
 		$eid=(int)$_POST['eid'];
		$id=(int)$_POST['id'];
		$_POST['uid']=(int)$_POST['uid'];
		unset($_POST['id']);
		if($_POST['name'])$_POST['name'] = $this->stringfilter($_POST['name']);
		if($_POST['content'])$_POST['content'] =$this->stringfilter($_POST['content']);
		if($_POST['title'])$_POST['title'] =$this->stringfilter($_POST['title']);
		if($_POST['department'])$_POST['department'] = $this->stringfilter($_POST['department']);
		if($_POST['specialty'])$_POST['specialty'] = $this->stringfilter($_POST['specialty']);
		if($_POST['sdate']){
			$_POST['sdate']=strtotime($_POST['sdate']);
		}
		if($_POST['edate']){
			$_POST['edate']=strtotime($_POST['edate']);
		}
		if($_FILES['photos']['tmp_name']){
			$UploadM=$this->MODEL('upload');
		    $upload=$UploadM->Upload_pic("../../data/upload/user/",false);
		    $pictures=$upload->picture($_FILES['photos']);
		    $UploadM->picmsg($pictures,$_SERVER['HTTP_REFERER']);
		    $pictures = str_replace("../../data/upload/user","./data/upload/user",$pictures);
		    $_POST['pic']=$pictures;
			$skill=$this->obj->DB_select_once("resume_skill","`id`='".$id."'","pic");
			if($skill['pic'] && (file_exists(str_replace('./',APP_PATH,$skill['pic'])))){
				unlink_pic("../.".$skill['pic']);
			}
		}
		if($id!=""){
			$where['id']=$id;
			$nid=$this->obj->update_once($table,$_POST,$where);
			if($nid){
				$data['error']=1;
				$data['msg']='修改成功！';
			}else{
				$data['error']=2;
				$data['msg']='修改成功！';
			}
		}else{
			$nid=$this->obj->insert_into($table,$_POST);
			if($nid){
				$data['error']=1;
				$data['msg']='添加成功！';
				$this->obj->DB_update_all("user_resume","`$url`=`$url`+1","`eid`='".$eid."' and `uid`='".$_POST['uid']."'");
			}else{
				$data['error']=2;
				$data['msg']='添加失败！';
			}
		}
		$resume_row=$this->obj->DB_select_once("user_resume","`eid`='".$eid."'");
		$numresume=$this->MODEL('resume')->complete($resume_row);
		$resume_row=$this->obj->DB_select_once("resume_expect","`id`='".$eid."'","`integrity`");
		//$data[integrity]=$resume_row['integrity'];
		//$data[numresume]=$numresume;
		$data[eid]=$eid;
		echo json_encode($data);die;
	}
	/*wxapp保存基本信息*/
	function saveinfo_action(){
	    $_POST=$this->post_trim($_POST);
	    if(!$_POST['name']||!$_POST['sex']||!$_POST['birthday']||!$_POST['edu']||!$_POST['exp']||!$_POST['telphone']||!$_POST['uid']){
			$data['error']=3;
			$data['msg']='请完善信息！';
			echo json_encode($data);die;
		}else{
			//$_POST = $this->CheckAppUser();
			$row=$this->obj->DB_select_once("resume","`uid`='".$_POST['uid']."'");
			if($_FILES['photos']['tmp_name']){
				$UploadM=$this->MODEL('upload');
			    $upload=$UploadM->Upload_pic("../../data/upload/user/",false,$this->config['user_pickb']);
			    $pictures=$upload->picture($_FILES['photos']);
			    $UploadM->picmsg($pictures,$_SERVER['HTTP_REFERER']);
			    $pictures = str_replace("../../data/upload/user","./data/upload/user",$pictures);
			    $_POST['wxewm']=$pictures;
				if($row['wxewm'] && (file_exists(str_replace('./',APP_PATH,$row['wxewm'])))){
					unlink_pic("../.".$row['wxewm']);
				}
			}
			if($row['moblie_status']!=1){
			    $mobile=$this->obj->DB_select_num("member","`uid`<>'".$_POST['uid']."' and `moblie`='".$_POST['telphone']."'","`uid`");
				if($mobile>0){
					$data['error']=3;
					$data['msg']='手机已存在！';
					echo json_encode($data);die;
				}else{
					$mvalue['moblie']=$_POST['telphone'];
				}
			}
			if($row['email_status']!=1&&!empty($_POST['email'])){
				$email=$this->obj->DB_select_num("member","`uid`<>'".$_POST['uid']."' and `email`='".$_POST['email']."'","`uid`");
				if($email>0){
					$data['error']=3;
					$data['msg']='邮箱已存在！';
					echo json_encode($data);die;
				}else{
					$mvalue['email']=$_POST['email'];
				}
			}else{
				$mvalue['email']=$_POST['email'];
			}
			$_POST['name']=$this->stringfilter($_POST['name']);
			$_POST['sex']=$this->stringfilter($_POST['sex']);
			$_POST['birthday']=$this->stringfilter($_POST['birthday']);
			$_POST['edu']=$this->stringfilter($_POST['edu']);
			$_POST['exp']=$this->stringfilter($_POST['exp']);
			$_POST['telphone']=$_POST['telphone'];
			$_POST['email']=$_POST['email'];
			$_POST['living']=$this->stringfilter($_POST['living']);
			$_POST['qq']=$_POST['qq'];
			$_POST['lastipdate']=time();
			delfiledir("../data/upload/tel/".$_POST['uid']);
			$where['uid']=$_POST['uid'];
			unset($_POST['uid']);
			$nid=$this->obj->update_once("resume",$_POST,$where);
			if($nid){
				if(!empty($mvalue)){
					$this->obj->update_once('member',$mvalue,$where);
				}
				$this->member_log("修改基本资料", $_POST['uid'], 1,7);
				if($row['name']==""||$row['living']==""){ 
					$IntegralM=$this->MODEL('integral');
					$IntegralM->company_invtal($where['uid'],$this->config['integral_userinfo'],true,"首次填写基本资料",true,2,'integral',25);
				}else{
					$this->obj->update_once("resume_expect",array("edu"=>$_POST['edu'],"exp"=>$_POST['exp'],"uname"=>$_POST['name'],"sex"=>$_POST['sex'],"birthday"=>$_POST['birthday']),$where);
				}
				$data['error']=1;
				$data['msg']='信息更新成功！';
			}else{
				$data['error']=2;
				$data['msg']='信息更新失败！';
			}
		}
		echo json_encode($data);die;
	}
	/*wxapp保存头像*/
	function savephoto_action(){
		if(!$_POST['uid']){
			$data['error']=3;
			$data['msg']='参数不正确！';
		}else{
			//$_POST = $this->CheckAppUser();
			if($_FILES['photos']['tmp_name']){
				$UploadM=$this->MODEL('upload');
			    $upload=$UploadM->Upload_pic("../../data/upload/user/",false,$this->config['user_pickb']);
			    $pictures=$upload->picture($_FILES['photos']);
			    $UploadM->picmsg($pictures,$_SERVER['HTTP_REFERER']);
			    $photo = str_replace("../../data/upload/user","./data/upload/user",$pictures);
			}
			$user=$this->obj->DB_select_once("resume","`uid`='".$_POST['uid']."'","`photo`,`resume_photo`");
			
			$resumesql['resume_photo']=$photo;
			$resumesql['photo']=$photo;
			if ($this->config['user_photo_status']==1){
			    $photo='';
			    $resumesql['photo_status']=1;
			}else{
			    $resumesql['photo_status']=0;
			}
			$nid=$this->obj->update_once("resume",$resumesql,array('uid'=>$_POST['uid']));
			$this->obj->DB_update_all("resume_expect","`photo`='".$photo."'","`uid`='".$_POST['uid']."'");
			$this->obj->DB_update_all("answer","`pic`='".$photo."'","`uid`='".$_POST['uid']."'");
			$this->obj->DB_update_all("question","`pic`='".$photo."'","`uid`='".$_POST['uid']."'");
			if(!$user['photo']){
			    $this->MODEL('integral')->get_integral_action($_POST['uid'],"integral_avatar","上传头像");
			}else{
			    if($user['photo'] && (file_exists(str_replace("./data/upload",APP_PATH."data/upload",$user['photo'])))){
			        unlink_pic(str_replace("./data/upload",APP_PATH."data/upload",$user['photo']));
			    }
			    if($user['resume_photo'] && (file_exists(str_replace("./data/upload",APP_PATH."data/upload",$user['resume_photo'])))){
			        unlink_pic(str_replace("./data/upload",APP_PATH."data/upload",$user['resume_photo']));
			    }
			}
			if($nid){
				$data['error']=1;
				$data['msg']='上传成功！';
			}else{
				$data['error']=2;
				$data['msg']='上传失败！';
			}
		}
		echo json_encode($data);die;
	}
	/*wxapp申请记录*/
	function sqjoblist_action()
	{
		$where=1;
		if($_POST['uid']){
			$where.=" and `uid`='".(int)$_POST['uid']."' order by datetime desc";
		}
		$rows=$this->obj->DB_select_all("userid_job",$where);
		if(is_array($rows) && !empty($rows)){
			$jobids=$day=$res = array();
			foreach($rows as $k=>$v){
				if(in_array($v['job_id'],$jobids)==false){
					$jobids[]=$v['job_id'];
				}
				$day[$k]['id']=$v['id'];
				$day[$k]['datetime']=date("Y-m-d",$v['datetime']);
			}
			foreach ($day as $value) {
				if(isset($res[$value['datetime']])){
					unset($value['datetime']);
				}else{
					$res[$value['datetime']] = $value;
				}
			}
			$jobs=$this->obj->DB_select_all("company_job","`id` in(".pylode(',',$jobids).")","`id`,`provinceid`,`cityid`,`three_cityid`");
			$list=array();
			include(PLUS_PATH."city.cache.php");
			foreach($rows as $key=>$va){
				foreach($jobs as $v){
					if($v['id']==$va['job_id']){
						$list[$key]['provinceid']	=$city_name[$v['provinceid']];
						$list[$key]['cityid']	=$city_name[$v['cityid']];
						$list[$key]['three_cityid']	=$city_name[$v['three_cityid']];	
					} 
				}
				foreach($res as $v){
					if($v['id']==$va['id']){
						$list[$key]['datetime_n'] 	=$v['datetime'];	
					} 
				}
				$list[$key]['id']			=$va['id'];
				$list[$key]['job_id']		=$va['job_id'];
				$list[$key]['job_name']	=$va['job_name'];
				$list[$key]['com_id']		=$va['com_id'];
				$list[$key]['com_name']	=$va['com_name'];
				$list[$key]['is_browse'] 	=$va['is_browse'];
			}
			foreach($list as $k=>$v){
				if(is_array($v)){
					foreach($v as $key=>$val){
						$list[$k][$key]=isset($val)?$val:'';
					}
				}else{
					$list[$k]=isset($v)?$v:'';
				}
			}
			$data['list']=count($list)?$list:array();
			$data['error']=1;
		}else{
			$data['error']=2;
		}
		echo json_encode($data);die;
	}
	/*wxapp申请记录删除*/
	function delsqjob_action()//删除申请的职位
	{
		if(!$_POST['ids'] || !$_POST['uid']){
			$data['error']=3;//参数不正确
			$data['msg']='参数不正确！';
			echo json_encode($data);die;
		}
		$ids=@explode(",",$_POST['ids']);
		$delid=pylode(",",$ids);
		$uid=(int)$_POST['uid'];
		$userid_job=$this->obj->DB_select_once("userid_job","`id` in (".$delid.") and `uid`='".$uid."'");
		$nid=$this->obj->DB_delete_all("userid_job","`id` in (".$delid.") and `uid`='".$uid."'"," ");
	    if($nid){
			$this->obj->DB_update_all('company_statis',"`sq_job`=`sq_job`-1","`uid`='".$userid_job['com_id']."'");
			$this->obj->DB_update_all('member_statis',"`sq_jobnum`=`sq_jobnum`-1","`uid`='".$userid_job['uid']."'");
			$this->member_log("删除申请的职位", $uid, 1,6,3);
	    	$data['error']=1;//删除成功
			$data['msg']='删除成功！';
	    }else{
	    	$data['error']=2;
			$data['msg']='删除失败！';
	    }
		echo json_encode($data);die;
	}
	/*wxapp收藏记录*/
	function favlist_action(){
		$where="`uid`='".(int)$_POST['uid']."' order by id desc";
		$rows=$this->obj->DB_select_all("fav_job",$where);
		if(is_array($rows) && !empty($rows)){
			$jobids=$list=$res=array();
			foreach($rows as $key=>$va){ 
				$jobids[]=$va['job_id'];
				$list[$key]['id']			=$va['id'];
				$list[$key]['job_id']		=$va['job_id'];
				$list[$key]['job_name']	=$va['job_name'];
				$list[$key]['com_id']		=$va['com_id'];
				$list[$key]['com_name']	=$va['com_name'];
				//$list[$key]['datetime'] 	=$va['datetime'];
				$day[$key]['id']=$va['id'];
				$day[$key]['datetime']=date("Y-m-d",$va['datetime']);
			}
			foreach ($day as $value) {
				if(isset($res[$value['datetime']])){
					unset($value['datetime']);
				}else{
					$res[$value['datetime']] = $value;
				}
			}
			$jobs=$this->obj->DB_select_all("company_job","`id` in(".pylode(',',$jobids).")","`id`,`salary`,`provinceid`,`cityid`,`three_cityid`,`state`");
			include(PLUS_PATH."city.cache.php");
			include(PLUS_PATH."com.cache.php");
			foreach($list as $k=>$v){
				foreach($res as $vv){
					if($vv['id']==$v['id']){
						$list[$k]['datetime_n'] 	=$vv['datetime'];	
					} 
				}
				foreach($jobs as $val){
					if($v['job_id']==$val['id']){
						$list[$k]['salary']=$comclass_name[$val['salary']];
						$list[$k]['provinceid']=$city_name[$val['provinceid']];
						$list[$k]['cityid']=$city_name[$val['cityid']];
						$list[$k]['three_cityid']=$city_name[$val['three_cityid']];
						$list[$k]['state']=$val['state'];
					} 
				}
			}
			foreach($list as $k=>$v){
				if(is_array($v)){
					foreach($v as $key=>$val){
						$list[$k][$key]=isset($val)?$val:'';
					}
				}else{
					$list[$k]=isset($v)?$v:'';
				}
			}
			$data['list']=count($list)?$list:array();
			$data['error']=1;
		}else{
			$data['error']=2;
		}
		echo json_encode($data);die;
	}
	/*wxapp收藏记录删除*/
	function delfavjob_action()//删除收藏的职位
	{
		if(!$_POST['ids'] || !$_POST['uid'])
		{
			$data['error']=3;//参数不正确
			$data['msg']='参数不正确！';
			echo json_encode($data);die;
		}
		$ids=@explode(",",$_POST['ids']);
		$delid=pylode(",",$ids);
		$uid=(int)$_POST['uid'];
		$nid=$this->obj->DB_delete_all("fav_job","`id` in (".$delid.") and `uid`='".$uid."'"," ");
	    if($nid){
	    	$this->obj->DB_update_all("member_statis","`fav_jobnum`=`fav_jobnum`-1","uid='".$uid."'");
	    	$this->member_log("删除收藏的职位", $uid, 1,5,3);
	    	$data['error']=1;//删除成功
			$data['msg']='删除成功！';
	    }else{
	    	$data['error']=2;
			$data['msg']='删除失败！';
	    }
		echo json_encode($data);die;
	}
	/*wxapp面试通知记录*/
	function invitelist_action(){
		$where="type<>'1'";
		if($_POST['uid']){
			$where.=" and `uid`='".(int)$_POST['uid']."' order by id desc";
		}
		$rows=$this->obj->DB_select_all("userid_msg",$where);
		if(is_array($rows) && !empty($rows)){
			foreach($rows as $key=>$va){
				$list[$key]['id']			=$va['id'];
				$list[$key]['fid']			=$va['fid'];
				$list[$key]['title']		=$va['title'];
				$list[$key]['content']		=$va['content'];
				$list[$key]['fname']		=$va['fname'];
				$list[$key]['jobname'] 	=$va['jobname'];
			}
			foreach($list as $k=>$v){
				if(is_array($v)){
					foreach($v as $key=>$val){
						$list[$k][$key]=isset($val)?$val:'';
					}
				}else{
					$list[$k]=isset($v)?$v:'';
				}
			}
			$data['list']=count($list)?$list:array();
			$data['error']=1;
		}else{
			$data['error']=2;
		}
		echo json_encode($data);die;
	}
	/*wxapp面试邀请页面-面试通知详情页*/
	function inviteshow_action()
	{
		//$_POST = $this->CheckAppUser();
		$id=(int)$_POST['id'];
		$uid=(int)$_POST['uid'];
		$info=$this->obj->DB_select_once("userid_msg","`id`='".$id."' and `uid`='".$uid."'");
		if($info['is_browse']==1){
			$this->obj->update_once("userid_msg",array('is_browse'=>2),array("id"=>$info['id']));
		}
		if(is_array($info) && !empty($info)){
			$list['id']		=$info['id'];
			$list['fid']	=$info['fid'];
			$list['jobid']	=$info['jobid'];
			$list['jobname']=$info['jobname'];
			$list['fname']	=$info['fname'];
			$list['intertime']	=$info['intertime'];
			$list['linkman']=$info['linkman'];
			$list['linktel']=$info['linktel'];
			$list['address']=$info['address'];
			$list['content']=$info['content'];
			$list['is_browse']=$info['is_browse'];
			$data['list']=$list;
			$data['error']=1;
		}else{
			$data['error']=2;
		}
		echo json_encode($data);die;
	}
	/*wxapp面试通知记录删除*/
	function invitedel_action(){
		//$_POST = $this->CheckAppUser();
		$id=(int)$_POST['id'];
		$uid=(int)$_POST['uid'];
		if($id){
			$info=$this->obj->DB_select_once("userid_msg","`id`='".$id."' and `uid`='".$uid."'");
			$arr['p_uid']=$info['fid'];
			$arr['inputtime']=mktime();
			$arr['c_uid']=$uid;
			$arr['usertype']=1;
			$arr['com_name']=$info['fname'];
			$haves=$this->obj->DB_select_once("blacklist","`c_uid`='".$uid."' and `p_uid`='".$info['fid']."'  and `usertype`='1'");
			if(is_array($haves)){
				$data['error']=2;
				$data['msg']='该用户已在您黑名单中！';
			}else{
				$nid=$this->obj->insert_into("blacklist",$arr);
				$this->obj->DB_delete_all("userid_msg","`uid`='".$uid."' and `fid`='".$info['fid']."'"," ");
				if($nid){
					$data['error']=1;
					$data['msg']='操作成功！';
				}else{
					$data['error']=2;
					$data['msg']='操作失败！';
				}
			}
		}else{
			$data['error']=2;
			$data['msg']='参数不正确！';
		}
		echo json_encode($data);die;
	}
	/*wxapp面试通知-同意、拒绝*/
	function inviteset_action(){
		//$_POST = $this->CheckAppUser();
		$id=(int)$_POST['id'];
		$uid=(int)$_POST['uid'];
		$browse=(int)$_POST['browse'];
		if($id){
			$nid=$this->obj->update_once("userid_msg",array('is_browse'=>$browse),array("id"=>$id,"uid"=>$uid));
			$comuid=$this->obj->DB_select_once("userid_msg","`id`='".$id."'",'fid,jobid');
			$comarr=$this->obj->DB_select_once("company_job","`id`='".$comuid['jobid']."' and `r_status`<>'2' and `status`<>'1'");
			$uidd=$this->obj->DB_select_once("company","`uid`='".$comuid['fid']."'","linkmail,linktel,name");
			$name=$this->obj->DB_select_once("resume","`uid`='".$uid."'","name");
			$datas['uid']=$comuid['fid'];
			$datas['cname']=$_POST['username'];
			$datas['name']=$uidd['name'];
			$datas['type']="yqmshf";
			$datas['cuid']=$uid;
			$datas['cusername']=$name['name'];
			if($browse==3){
				$datas['typemsg']='同意';
			}elseif($browse==4){
				$datas['typemsg']='拒绝';
			}	
			if($this->config['sy_msg_yqmshf']=='1'&&$uidd["linktel"]&&$this->config["sy_msguser"]&&$this->config["sy_msgpw"]&&$this->config["sy_msgkey"]&&$this->config['sy_msg_isopen']=='1'){$datas["moblie"]=$uidd["linktel"]; }
			if($this->config['sy_email_yqmshf']=='1'&&$uidd["linkmail"]&&$this->config['sy_email_set']=="1"){$datas["email"]=$uidd["linkmail"]; }
			if($datas["email"]||$datas['moblie']){
        $notice = $this->MODEL('notice');
        $notice->sendEmailType($datas);
        $notice->sendSMSType($datas);
			}
			if($nid){
				$data['error']=1;
				$data['msg']='操作成功！';
			}else{
				$data['error']=2;
				$data['msg']='操作失败！';
			}
		}else{
			$data['error']=2;
			$data['msg']='参数不正确！';
		}
		echo json_encode($data);die;
	}
	/*wxapp简历管理页面刷新*/
	function refresh_resume_action(){
		if(!$_POST['id']){
			$data['error']=3;
			$data['msg']='参数不正确！';
		}else{
		    $expect=$this->obj->DB_select_once("resume_expect","`id`='".(int)$_POST['id']."'",'`uid`');
			$id=$this->obj->DB_update_all("resume_expect","`lastupdate`='".time()."'","`id`='".(int)$_POST['id']."'");
			if($id){
				$data['error']=1;
				$data['msg']='刷新成功！';
				$this->member_log('简历刷新成功', $expect['uid'], 1);
			}else{
				$data['error']=2;
				$data['msg']='刷新失败！';
			}
		}
		echo json_encode($data);die;
	}
	/*wxapp简历管理页面设置默认*/
	function default_resume_action(){
		if(!$_POST['id']||!$_POST['uid']){
			$data['error']=3;
			$data['msg']='参数不正确！';
		}else{
			$id=$this->obj->DB_update_all("resume","`def_job`='".(int)$_POST['id']."'","`uid`='".(int)$_POST['uid']."'");
            $this->obj->DB_update_all("resume_expect","`defaults`=''","`uid`='".(int)$_POST['uid']."'");
            $this->obj->DB_update_all("resume_expect","`defaults`='1'","`uid`='".(int)$_POST['uid']."' and `id`='".(int)$_POST['id']."'");
			
			if($id){
			    $this->member_log("设置默认简历", $_POST['uid'], 1,2,2);
				$data['error']=1;
				$data['msg']='设置成功！';
			}else{
				$data['error']=2;
				$data['msg']='设置失败！';
			}
		}
		echo json_encode($data);die;
	}
	/*wxapp简历管理页面设置是否公开*/
	function status_resume_action(){
	    if(!$_POST['id']||!$_POST['uid']){
	        $data['error']=3;
	        $data['msg']='参数不正确！';
	    }else{
	        $nid=$this->obj->DB_update_all("resume_expect","`status`=".$_POST['status']."","`uid`='".(int)$_POST['uid']."' and `id`='".(int)$_POST['id']."'");
	        if($nid){
	            $this->member_log("设置简历公开状态", $_POST['uid'], 1,2,2);
	            $data['error']=1;
	            $data['msg']='设置成功！';
	        }else{
	            $data['error']=2;
	            $data['msg']='设置失败！';
	        }
	    }
	    echo json_encode($data);die;
	}
	/*wxapp简历管理页面删除*/
	function del_resume_action(){
		if(!$_POST['id']||!$_POST['table']||!$_POST['uid']){
			$data['error']=3;
			$data['msg']='参数不正确！';
		}else{
			//$_POST = $this->CheckAppUser();
			$_POST['id']=(int)$_POST['id'];
			$_POST['uid']=(int)$_POST['uid'];
			$table=$_POST['table'];
			$tables=array("expect","skill","work","project","edu","training","cert","other");
			if(!in_array($table,$tables)){
				$data['error']=3;
				$data['msg']='参数不正确！';
			}else{
				$row_item=$this->obj->DB_select_once("resume_".$table,"`id`='".$_POST['id']."'");
				$id=$this->obj->DB_delete_all("resume_".$table,"`id`='".$_POST['id']."'");
				$eid=($table=='expect')?$row_item['id']:$row_item['eid'];
				if($id){
					if($_POST['table']=="expect"){
						$del_array=array("resume_cert","resume_edu","resume_other","resume_project","resume_skill","resume_training","resume_work","resume_doc","user_resume","down_resume","user_entrust","user_entrust_record");
						foreach($del_array as $v){
							$this->obj->DB_delete_all($v,"`eid`='".$_POST['id']."'' and `uid`='".$_POST['uid']."'","");
						}
						$this->obj->DB_delete_all("look_resume","`resume_id`='".$_POST['id']."'");
						//$this->obj->DB_update_all("resume","`expect`=`expect`-1","`uid`='".$_POST['uid']."'");
						$def_id=$this->obj->DB_select_once("resume","`uid`='".$_POST['uid']."' and `def_job`='".$_POST['id']."'");
					    if(is_array($def_id)){
							$row=$this->obj->DB_select_once("resume_expect","`uid`='".$_POST['uid']."'");
							if($row){
								$this->obj->update_once('resume_expect',array('defaults'=>1),array('id'=>$row['id']));
								$this->obj->DB_update_all("resume","`def_job`='".$row['id']."'","`uid`='".$_POST['uid']."'");
							}
					    }
						$num=$this->obj->DB_select_num("resume_expect","`uid`='".$_POST['uid']."'");
						$this->obj->DB_update_all('member_statis',"`resume_num`='".$num."'","`uid`='".$_POST['uid']."'"); 
 					}else{
						$this->obj->DB_update_all("user_resume","`$table`=`$table`-1","`eid`='".$eid."' and  `uid`='".$_POST['uid']."'");
						$resume_row=$this->obj->DB_select_once("user_resume","`eid`='".$eid."'");
						$this->MODEL('resume')->complete($resume_row);
						if($_POST['type']=='work'){
							$workList = $this->obj->DB_select_all("resume_work","`eid`='".$eid."' AND `uid`='".$_POST['uid']."'","`sdate`,`edate`");
							$whour = 0;
							foreach($workList as $value){
								if ($value['edate']){
									$workTime = ceil(($value['edate']-$value['sdate'])/(30*86400));
								}else{
									$workTime = ceil((time()-$value['sdate'])/(30*86400));
								}
								$hour[] = $workTime;
								$whour += $workTime;
							}
							$avghour = ceil($whour/count($hour));
							$this->obj->DB_update_all("resume_expect","`whour`='".$whour."',`avghour`='".$avghour."'","`id`='".$eid."' AND `uid`='".$_POST['uid']."'");
						}
					}
					$data['error']=1;
					$data['msg']='删除成功！';
				}else{
					$data['error']=2;
					$data['msg']='删除失败！';
				}
			}
		}
		echo json_encode($data);die;
	}
	/*wxapp谁看过我记录*/
	function look_resume_action()//简历浏览记录
	{
		if(!$_POST['uid']){
			$data['error']=3;
			echo json_encode($data);die;
		}
		$where.="`uid`='".(int)$_POST['uid']."' and `status`='0' order by `datetime` desc";
		$rows=$this->obj->DB_select_all("look_resume",$where);
		if(is_array($rows) && !empty($rows)){
			$res=$day=$com_uid=$res_uid=array();
			foreach($rows as $k=>$v){
				$com_uid[] = $v['com_id'];
				$res_uid[] = $v['resume_id'];
				$day[$k]['id']=$v['id'];
				$day[$k]['datetime']=date("Y-m-d",$v['datetime']);
			}
			foreach ($day as $value) {
				if(isset($res[$value['datetime']])){
					unset($value['datetime']);
				}else{
					$res[$value['datetime']] = $value;
				}
			}
			$resume=$this->obj->DB_select_all("resume_expect","`id` IN (".pylode(",",$res_uid).")","id,name");
			$com=$this->obj->DB_select_all("company","`uid` IN (".pylode(",",$com_uid).")","uid,name");
			foreach($rows as $key=>$va){
				foreach($res as $v){
					if($v['id']==$va['id']){
						$list[$key]['datetime_n'] 	=$v['datetime'];	
					} 
				}
				foreach($resume as $k=>$v)
				{
					if($va['resume_id']==$v['id'])
					{
						$list[$key]['resume_name']=$v['name'];
					}
				}
				foreach($com as $value)
				{
					if($va['com_id']==$value['uid'])
					{
						$list[$key]['com_name']=$value['name'];
					}
				}
				$list[$key]['id']			=$va['id'];
				$list[$key]['com_id']		=$va['com_id'];
				$list[$key]['resume_id']	=$va['resume_id'];
				$list[$key]['status']		=$va['status'];
				$list[$key]['com_status']	=$va['com_status'];
				//$list[$key]['datetime']		=$va['datetime'];
			}
			foreach($list as $k=>$v){
				if(is_array($v)){
					foreach($v as $key=>$val){
						$list[$k][$key]=isset($val)?$val:'';
					}
				}else{
					$list[$k]=isset($v)?$v:'';
				}
			}
			$data['list']=count($list)?$list:array();
			$data['error']=1;
		}else{
			$data['error']=2;
		}
		echo json_encode($data);die;
	}
	/*wxapp谁看过我记录删除*/
	function look_resume_del_action()//删除简历浏览记录
	{
		if(!$_POST['uid'] || !$_POST['ids']){
			$data['error']=3;
			$data['msg']='参数不正确！';
			echo json_encode($data);die;
		}
		$uid = (int)$_POST['uid'];
		$id=$this->obj->DB_update_all("look_resume","`status`='1'","`uid`='".$uid."' and `id` in (".$_POST['ids'].")","");
		if($id){
		    $this->member_log("删除简历浏览记录（ID:".$_POST['ids']."）", $uid, 1,26,3);
			$data['error']=1;
			$data['msg']='删除成功！';
		}else{
			$data['error']=2;
			$data['msg']='删除失败！';
		}
		echo json_encode($data);die;
	}
	/*wxapp浏览记录*/
	function look_job_action(){//职位浏览记录
		//$_POST = $this->CheckAppUser();
		$page=$_POST['page'];
		$limit=$_POST['limit'];
		$limit=!$limit?10:$limit;
		if(!$_POST['uid']){
			$data['error']=3;
			echo json_encode($data);die;
		}
		$where.="`uid`='".(int)$_POST['uid']."' and `status`='0' order by `datetime` desc";
		if($page){
			$pagenav=($page-1)*$limit;
			$where.=" limit $pagenav,$limit";
		}else{
			$where.=" limit $limit";
		}
		$rows=$this->obj->DB_select_all("look_job",$where);
		if(is_array($rows) &&!empty($rows)){
			include(PLUS_PATH."city.cache.php");
			include(PLUS_PATH."com.cache.php");
			$res=$day=$jobid=array();
			foreach($rows as $k=>$v){
				$jobid[]=$v['jobid'];
				$day[$k]['id']=$v['id'];
				$day[$k]['datetime']=date("Y-m-d",$v['datetime']);
			}
			foreach ($day as $value) {
				if(isset($res[$value['datetime']])){
					unset($value['datetime']);
				}else{
					$res[$value['datetime']] = $value;
				}
			}
			$job=$this->obj->DB_select_all("company_job","`id` in (".pylode(",",$jobid).")","`id`,`name`,`com_name`,`minsalary`,`maxsalary`,`provinceid`,`cityid`,`three_cityid`,`state`,`status`,`edate`");
			foreach($rows as $key=>$val){
				foreach($job as $va){
					if($val['jobid']==$va['id']){
						$rows[$key]['jobname']=$va['name'];
						$rows[$key]['com_name']=$va['com_name'];
						$rows[$key]['minsalary']=$va['minsalary'];
						$rows[$key]['maxsalary']=$va['maxsalary'];
						$rows[$key]['provinceid']=$va['provinceid'];
						$rows[$key]['cityid']=$va['cityid'];
						$rows[$key]['three_cityid']=$va['three_cityid'];
						$rows[$key]['state']=$va['state'];
						$rows[$key]['status']=$va['status'];
						$rows[$key]['edate']=$va['edate'];
					}
				}
			}
			foreach($rows as $key=>$va){
				foreach($res as $v){
					if($v['id']==$va['id']){
						$list[$key]['datetime_n'] 	=$v['datetime'];	
					} 
				}
				$list[$key]['id']			=$va['id'];
				$list[$key]['jobid']		=$va['jobid'];
				$list[$key]['com_id']		=$va['com_id'];
				$list[$key]['com_name']	=$va['com_name'];
				$list[$key]['jobname']		=$va['jobname'];
				if($va['minsalary']&&$va['maxsalary']){
					$salary='￥'.$va['minsalary'].'-'.$va['maxsalary'];
				}elseif(!$va['minsalary']&&$va['maxsalary']){
					$salary='￥'.$va['maxsalary'];
				}elseif($va['minsalary']&&!$va['maxsalary']){
					$salary='￥'.$va['minsalary'];
				}else{
					$salary='面议';
				}
				$list[$key]['salary_n']=$salary;
				$list[$key]['provinceid_n']=$city_name[$va['provinceid']];
				$list[$key]['cityid_n']=$city_name[$va['cityid']];
				$list[$key]['threecityid_n']=$city_name[$va['three_cityid']];
				if($va['status']=='1'||$va['state']!='1'){
					$jobstate=3;
				}else{
					$jobstate=1;
				}
				$list[$key]['jobstate']=$jobstate;
			}
			foreach($list as $k=>$v){
				if(is_array($v)){
					foreach($v as $key=>$val){
						$list[$k][$key]=isset($val)?$val:'';
					}
				}else{
					$list[$k]=isset($v)?$v:'';
				}
			}
			$data['list']=count($list)?$list:array();
			$data['error']=1;
		}else{
			$data['error']=2;
		}
		echo json_encode($data);die;
	}
	/*wxapp浏览记录删除*/
	function look_job_del_action()//删除职位浏览记录
	{
		//$_POST = $this->CheckAppUser();
		if(!$_POST['uid'] || !$_POST['ids']){
			$data['error']=3;
			$data['msg']='参数不正确！';
			echo json_encode($data);die;
		}
		$uid = (int)$_POST['uid'];
		$id=$this->obj->DB_update_all("look_job","`status`='1'","`uid`='".$uid."' and `id` in (".$_POST['ids'].")","");
		if($id){
		    $this->member_log("删除浏览职位记录（ID:".$_POST['ids']."）", $uid, 1,26,3);
			$data['error']=1;
			$data['msg']='删除成功！';
		}else{
			$data['error']=2;
			$data['msg']='删除失败！';
		}
		echo json_encode($data);die;
	}
	/*wxapp相似职位*/
	function like_job_action(){
		if(!$_POST['uid']){
			$data['error']=3;
			echo json_encode($data);die;
		}
		$id=(int)$_POST['id'];
		$resumeexp=$this->obj->DB_select_once("resume_expect","`id`='".$id."'","uid,job_classid,cityid,three_cityid,exp,edu,report");
		$resume=$this->obj->DB_select_once("resume","`uid`='".$resumeexp['uid']."'","marriage");
		if($resumeexp['job_classid']!=""){
			$jobclass=@explode(",",$resumeexp['job_classid']);
			foreach($jobclass as $v){
				$where[]=$v;
			}
			$where=" and (`job_post` in (".@implode(" , ",$where).") or `job1_son` in (".@implode(" , ",$where)."))and `cityid`='".$resumeexp['cityid']."' order by id desc ";
		}
		$time = time();
		$select="id,name,com_name,three_cityid,edu,sex,marriage,report,exp,minsalary,maxsalary,uid";
		$rows=$this->obj->DB_select_all("company_job","`sdate`<'".$time."'and `r_status`<>2 and `status`<>1  and `edate`>'".$time."' and `state`='1' ".$where,$select);  
		if(is_array($rows) &&!empty($rows)){
			include PLUS_PATH."/user.cache.php";
			include PLUS_PATH."/com.cache.php";
			include(CONFIG_PATH."db.data.php");
			foreach($rows as $k=>$v){
				$pre=60;
				if($v['three_cityid']==$resumeexp['three_cityid']){//地区
					$pre=$pre+10;
				}
				if($userclass_name[$resumeexp['edu']]==$comclass_name[$v['edu']] || $comclass_name[$v['edu']]=="不限"){//学历
					$pre=$pre+5;
				}
				if($userclass_name[$resume['marriage']]==$comclass_name[$v['marriage']] || $comclass_name[$v['sex']]=="不限"){//婚姻
					$pre=$pre+5;
				}
				if($rows['sex']==$v['sex']){
					$pre=$pre+5;
				}
				if($userclass_name[$resumeexp['report']]==$comclass_name[$v['report']] || $comclass_name[$v['report']]=="不限"){//到岗时间
					$pre=$pre+5;
				}
				if($userclass_name[$resumeexp['exp']]==$comclass_name[$v['exp']] || $comclass_name[$v['exp']]=="不限"){//工作经验
					$pre=$pre+5;
				}
				$rows[$k]['pre']=$pre;
			}
			$sort = array(
					'direction' => 'SORT_DESC',
					'field'     => 'pre',     
			);
			$arrSort = array();
			foreach($rows AS $uniqid => $row){
				foreach($row AS $key=>$value){
					$arrSort[$key][$uniqid] = $value;
				}
			}
			if($sort['direction']){
				array_multisort($arrSort[$sort['field']], constant($sort['direction']), $rows);
			}

			foreach($rows as $key=>$va){
				$list[$key]['id']			=$va['id'];
				$list[$key]['uid']		=$va['uid'];
				$list[$key]['com_name']	=$va['com_name'];
				$list[$key]['name']		=$va['name'];
				if($va['minsalary']&&$va['maxsalary']){
					$salary='￥'.$va['minsalary'].'-'.$va['maxsalary'];
				}elseif(!$va['minsalary']&&$va['maxsalary']){
					$salary='￥'.$va['maxsalary'].'以下';
				}elseif($va['minsalary']&&!$va['maxsalary']){
					$salary='￥'.$va['minsalary'].'以上';
				}else{
					$salary='面议';
				}
				$list[$key]['sex_n']=$arr_data['sex'][$v['sex']];
				$list[$key]['salary_n']=$salary;
				$list[$key]['report_n']=$comclass_name[$va['report']];
				$list[$key]['exp_n']=$comclass_name[$va['exp']];
				$list[$key]['edu_n']=$comclass_name[$va['edu']];
				$list[$key]['pre']		=$va['pre'];
			}
			foreach($list as $k=>$v){
				if(is_array($v)){
					foreach($v as $key=>$val){
						$list[$k][$key]=isset($val)?$val:'';
					}
				}else{
					$list[$k]=isset($v)?$v:'';
				}
			}
			$data['list']=count($list)?$list:array();
			$data['error']=1;
		}else{
			$data['error']=2;
		}
		echo json_encode($data);die;
	}
	
	//快速投递
	function temporaryresume_action(){
	    $_POST=$this->post_trim($_POST);
	    $arr = array(
	        'error' => '2',
	        'url' => '',
	        'msg' => ''
	    );
	    if(!$_POST['uname'] || !$_POST['birthday'] || !$_POST['exp'] || !$_POST['edu'] || !$_POST['telphone']){
	        $arr['status']='2';
	        $arr['msg']='请填写必要申请信息！';
	    }else{
	        $Member=$this->MODEL("userinfo");
	        $ismoblie= $Member->GetMemberNum(array("moblie"=>$_POST['telphone']));
	        if($ismoblie>0){
	            $arr['error']='2';
	            $arr['msg']='手机已存在！';
	        }else{
    	        $integrity = 55;
    	        /**************************简历是否必填工作经历*************************************************/
    	        if($this->config['resume_create_exp']=='1'){
    	            if(!$_POST['workname'] || !$_POST['worksdate'] || !$_POST['worktitle']){
    	                $data['error']=11;
    	                $data['msg']='请填写工作经历！';
    	                echo json_encode($data);die;
    	            }
    	            if($_POST['workedate']){
    	                if(strtotime($_POST['workedate'])<strtotime($_POST['worksdate'])){
    	                    $data['error']=11;
    	                    $data['msg']='工作经历结束时间不能小于开始时间！';
    	                    echo json_encode($data);die;
    	                }else{
    	                    $expData['edate']  = strtotime($_POST['workedate']);
    	                }
    	            }else{
    	                $expData['edate']  = 0;
    	            }
    	            $expData['name']  = $_POST['workname'];
    	            $expData['sdate'] = strtotime($_POST['worksdate']);
    	            $expData['title']  = $_POST['worktitle'];
    	            $expData['content']  = $_POST['workcontent'];
    	            $integrity += 10;
    	            if ($expData['edate']>0){
    	                $whour = ceil(($expData['edate']-$expData['sdate'])/(30*86400));
    	            }else{
    	                $whour = ceil((time()-$expData['sdate'])/(30*86400));
    	            }
    	        }
    	        /**************************简历是否必填教育经历*************************************************/
    	        if($this->config['resume_create_edu']=='1'){
    	            if(!$_POST['eduname'] || !$_POST['edusdate'] || !$_POST['eduedate'] || !$_POST['education'] || !$_POST['eduspec']){
    	                $data['status']='2';
    	                $data['msg']='请填写教育经历！';
    	                echo json_encode($data);die;
    	            }
    	            if(strtotime($_POST['eduedate'])<strtotime($_POST['edusdate'])){
    	                $data['status']='2';
    	                $data['msg']='教育经历离校时间不能小于入校时间！';
    	                echo json_encode($data);die;
    	            }else{
    	                $eduData['edate']  = strtotime($_POST['eduedate']);
    	            }
    	            $eduData['name']  = $_POST['eduname'];
    	            $eduData['sdate'] = strtotime($_POST['edusdate']);
    	            $eduData['specialty']  = $_POST['eduspec'];
    	            $eduData['education']  = $_POST['education'];
    	            $integrity += 10;
    	        }
    	        /**************************简历是否必填项目经历*************************************************/
    	        if($this->config['resume_create_project']=='1'){
    	            if(!$_POST['proname'] || !$_POST['prosdate'] || !$_POST['protitle'] || !$_POST['proedate']){
    	                $data['status']='2';
    	                $data['msg']='请填写项目经历！';
    	                echo json_encode($data);die;
    	            }
    	            if(strtotime($_POST['proedate'])<strtotime($_POST['prosdate'])){
    	                $data['status']='2';
    	                $data['msg']='项目经历结束时间不能小于开始时间！';
    	                echo json_encode($data);die;
    	            }else{
    	                $proData['edate']  = strtotime($_POST['proedate']);
    	            }
    	            $proData['name']  = $_POST['proname'];
    	            $proData['sdate'] = strtotime($_POST['prosdate']);
    	            $proData['title']  = $_POST['protitle'];
    	            $proData['content']  = $_POST['procontent'];
    	            $integrity += 8;
    	        }
	        
	            $Job=$this->MODEL('job');
	            $jobinfo=$Job->GetComjobOne(array('id'=>(int)$_POST['jobid']),array('field'=>'`name`,`hy`,`job1`,`job1_son`,`job_post`,`provinceid`,`cityid`,`three_cityid`,`minsalary`,`maxsalary`'));
	            include PLUS_PATH."user.cache.php";
	            include PLUS_PATH."job.cache.php";
	            $_POST['hy']=$jobinfo['hy'];
	            if($jobinfo['job_post']){
	                $_POST['job_classid']=$jobinfo['job_post'];
	            }elseif($jobinfo['job1_son']){
	                $_POST['job_classid']=$jobinfo['job1_son'];
	            }else{
	                $_POST['job_classid']=$jobinfo['job1'];
	            }
	            $_POST['name']=$job_name[$_POST['job_classid']]?$job_name[$_POST['job_classid']]:$jobinfo['name'];
	            
	            $_POST['jobstatus'] = $userdata['user_jobstatus'][0];
	            $_POST['minsalary']=$jobinfo['minsalary'];
	            $_POST['maxsalary']=$jobinfo['maxsalary'];
	            if ($jobinfo['three_cityid']){
	                $_POST['city_classid']=$jobinfo['three_cityid'];
	            }elseif($jobinfo['cityid']){
	                $_POST['city_classid']=$jobinfo['cityid'];
	            }else{
	                $_POST['city_classid']=$jobinfo['provinceid'];
	            }
	            $_POST['integrity'] = $integrity;
	            $Resume=$this->MODEL("resume");
	            if(intval($_POST['resumeid'])){
	                $this->obj->update_once('temporary_resume',$_POST,array('id'=>intval($_POST['resumeid'])));
	                $id=intval($_POST['resumeid']);
	            }else{
	                $id=$Resume->TemporaryResume($_POST);
	            }
	            if ($id){
	                //工作经历、教育经历、项目经历
	                if(!empty($expData)){
	                    $expData['tid'] = $id;
	                    $this->obj->insert_into("resume_work",$expData);
	                }
	                if(!empty($eduData)){
	                    $eduData['tid'] = $id;
	                    $this->obj->insert_into("resume_edu",$eduData);
	                }
	                if(!empty($proData)){
	                    $proData['tid'] = $id;
	                    $this->obj->insert_into("resume_project",$proData);
	                }
	            }
	            $arr['error']='1';
	            $arr['resumeid']=$id;
	            $data['jobid']=$_POST['jobid'];
	            $arr['msg']='创建简历成功,请完成下一步';
	        }
	    }
	        
	    echo json_encode($arr);die;
	}
	//快速投递注册
	function userreg_action(){
	    $Resume=$this->MODEL("resume");
	    $row=$Resume->SelectTemporaryResume(array("id"=>$_POST['resumeid']));
	    $Member=$this->MODEL("userinfo");
	    $ismoblie= $Member->GetMemberNum(array("moblie"=>$row['telphone']));
	    if($ismoblie>0){
	        $arr['error']='2';
	        $arr['msg']='当前手机号已被使用，请更换其他手机号！';
	    }elseif(!$row['name'] || !$row['birthday'] || !$row['exp'] || !$row['edu'] || !$row['telphone']){
	        $arr['error']='2';
	        $arr['msg']='请填写必要申请信息！';
	        
	    }else{
	        
	        $salt = substr(uniqid(rand()), -6);
	        $pass = md5(md5($_POST['password']).$salt);
	        $ip=fun_ip_get();
	        $data=array();
	        $data['username']=$this->checkuser($row['telphone']);
	        $data['password']=$pass;
	        $data['usertype']=1;
	        $data['status']=1;
	        $data['source']=13;
	        $data['moblie']=$row['telphone'];
	        $data['salt']=$salt;
	        $data['reg_date']=time();
	        $data['login_date']=time();
	        $data['reg_ip']=$ip;
	        $data['login_ip']=$ip;
	        $data['did']=$this->config['did'];
	        
	        $userid=$Member->AddMember($data);
	        if($userid){
	            $Member->InsertReg("member_statis",array("uid"=>$userid,"resume_num"=>"1","did"=>$this->config['did']));
	            $Member->InsertReg("resume",array("uid"=>$userid,'lastupdate'=>time()));
	            //$this->cookie->add_cookie($userid,$row['telphone'],$salt,"",$pass,1,1,$this->config['did']);
	            $Resume=$this->MODEL("resume");
	            $row=$Resume->SelectTemporaryResume(array("id"=>$_POST['resumeid']));
	            $edata['uid']=$userid;
	            $edata['name']=$row['name'];
	            $edata['hy']=$row['hy'];
	            $edata['job_classid']=$row['job_classid'];
	            $edata['city_classid']=$row['city_classid'];
	            $edata['minsalary']=$row['minsalary'];
	            $edata['maxsalary']=$row['maxsalary'];
	            $edata['jobstatus']=$row['jobstatus'];
	            $edata['type']=$row['type'];
	            $edata['report']=$row['report'];
	            $edata['defaults']=1;
	            $edata['integrity']=$row['integrity'];
	            $edata['ctime']=time();
	            $edata['lastupdate']=time();
	            $edata['did']=$this->config['did'];
	            $edata['uname']=$rdata['name']=$row['uname'];
	            $edata['edu']=$rdata['edu']=$row['edu'];
	            $edata['exp']=$rdata['exp']=$row['exp'];
	            $edata['sex']=$rdata['sex']=$row['sex'];
	            $edata['birthday']=$rdata['birthday']=$row['birthday'];
	            $edata['r_status']=$this->config['resume_status'];
	            $edata['source']=13;
	            $eid=$Resume->AddResume("resume_expect",$edata);
	            $Resume->AddUserResume(array("uid"=>$userid,"eid"=>$eid,"expect"=>"1"));
	            //简历完成度大于55的需要修改工作经历、教育经历、项目经历
	            if ($row['integrity']>55){
	                $this->obj->update_once('resume_edu',array('uid'=>$userid,'eid'=>$eid,'tid'=>''),array('tid'=>$row['id']));
	                $this->obj->update_once('resume_project',array('uid'=>$userid,'eid'=>$eid,'tid'=>''),array('tid'=>$row['id']));
	                $this->obj->update_once('resume_work',array('uid'=>$userid,'eid'=>$eid,'tid'=>''),array('tid'=>$row['id']));
	            }
				//同步工作时长
				$Resume->Upwour($eid,$userid);
	            //处理简历选择多城市、多城市
				$Resume->addCityclass($eid,$userid,$row['city_classid']);
				$Resume->addJobclass($eid,$userid,$row['job_classid']);
	            $Resume->DelTemporaryResume(array("id"=>$_POST['resumeid']));
	            $rdata['def_job']=$eid;
	            $rdata['resumetime']=time();
	            $rdata['lastupdate']=time();
	            $rdata['telphone']=$row['telphone'];
	            $rdata['email']=$row['email'];
	            $rdata['living']=$row['living'];
	            if($this->config['reg_real_name_check'] == 1){
	                $rdata['moblie_status'] = 1;
	            }
	            $Member->UpdateUserinfo(array("usertype"=>"1","values"=>$rdata),array("uid"=>$userid));
	            $Member->UpdateMember(array("moblie"=>$row['telphone'],"email"=>$row['email']),array("uid"=>$userid));
	            if($this->config['integral_reg']>0){
	                $this->MODEL('integral')->company_invtal($userid,$this->config['integral_reg'],true,"注册赠送",true,2,'integral',23);
	            }
	            $this->MODEL('integral')->get_integral_action($userid,"integral_login","会员登录");
	            if($this->config['integral_userinfo']>0){
	                $this->MODEL('integral')->company_invtal($userid,$this->config['integral_userinfo'],true,"首次填写基本资料",true,2,'integral',25);
	            }
	            $this->MODEL('integral')->get_integral_action($userid,"integral_add_resume","发布简历");
	            $jobid=(int)$_POST['jobid'];
	            $Job=$this->MODEL("job");
	            $comjob=$Job->GetComjobOne(array("id"=>$jobid));
	            $value['job_id']=$jobid;
	            $value['com_name']=$comjob['com_name'];
	            $value['job_name']=$comjob['name'];
	            $value['com_id']=$comjob['uid'];
	            $value['uid']=$userid;
	            $value['eid']=$eid;
	            $value['datetime']=mktime();
	            $nid=$Job->AddUseridJob($value);
				$Job->UpdateComjob(array("`snum`=`snum`+1"),array("id"=>$jobid));
	            $historyM = $this->MODEL('history');
	            $historyM->addHistory('useridjob',$_POST['jobid']);
	            $arr['error']='1';
	            $arr['uid'] = $userid;
	            $arr['usertype']=1;
	            $arr['msg']='申请成功！';
	            
	            if($comjob['link_type']=='1'){
	                $ComM=$this->MODEL("company");
	                $job_link=$ComM->GetCompanyInfo(array("uid"=>$comjob['uid']),array("field"=>"`linkmail` as email,`linktel` as link_moblie"));
	            }else{
	                $job_link=$Job->GetComjoblinkOne(array("jobid"=>$jobid,"is_email"=>"1"),array("field"=>"`email`,`link_moblie`"));
	            }
	            
	            $notice = $this->MODEL('notice');
	            if($this->config['sy_email_set']=="1"){
	                if($job_link['email']){
	                    $contents=@file_get_contents(Url("resume",array("c"=>"sendresume","job_link"=>'1',"id"=>$eid)));
	                    $emaildata = array(
	                        'email' => $job_link['email'],
	                        'subject' => "您收到一份新的求职简历！——".$this->config['sy_webname'],
	                        'content' => $contents,
	                        
	                        'uid'=>$comjob['uid'],
	                        'name'=>$comjob['com_name'],
	                        'cuid'=>'',
	                        'cname'=>'',
	                        'tbContent'=>'简历详情eid:' . $eid
	                    );
	                    $notice->sendEmail($emaildata);
	                }
	            }
	            if($this->config['sy_msg_isopen']=='1'){
	                if($job_link['link_moblie']){
	                    $data=array('uid'=>$comjob['uid'],'name'=>$comjob['com_name'],'cuid'=>'','cname'=>'','type'=>'sqzw','jobname'=>$comjob['name'],'date'=>date("Y-m-d"),'moblie'=>$job_link['link_moblie']);
	                    $notice->sendSMSType($data);
	                }
	            }
	            //推送
	            $push = $this->getPush();
	            if ($push){
	                $content=mb_substr($content = '职位：'.$comjob['name'].'有新的申请', 0, 24, 'UTF-8');
	                $this->makePush($row['uname'], $content, array('uid'=>$comjob['uid']), $push);
	            }
	        }else{
	            $arr['error']='3';
	            $arr['msg']='申请失败！';
	        }
	    }
	    
	    echo json_encode($arr);die;
	}
	function checkuser($username,$name=''){
	    
	    $user = $this->obj->DB_select_once("member","`username`='".$username."'","`uid`");
	    if($user['uid']){
	        $name.="_".rand(1000,9999);
	        return $this->checkuser($name,$username);
	    }else{
	        return $username;
	    }
	}
	//身份证审核查询
	function getidcard_action(){
	    $resume = $this->obj->DB_select_once("resume","`uid`='".$_POST['uid']."'");
	    if($resume['idcard_pic']){
	        if (strpos($resume['idcard_pic'], './data')!==false){
	            $url=str_replace("./data",$this->config['sy_weburl']."/data",$resume['idcard_pic']);
	        }else{
	            if (strpos($resume['idcard_pic'], 'http')!==false){
	                $url=str_replace("/data",$this->config['sy_weburl']."/data",$resume['idcard_pic']);
	            }
	        }
	        $return = array(
	            'url'=>$url,
	            'idcard'=>$resume['idcard'],
	            'status'=>$resume['idcard_status'],
	            'file_maxsize'=>$this->config['file_maxsize'],
	            'error'=>1
	        );
	    }else{
	        $return = array('error'=>2,'file_maxsize'=>$this->config['file_maxsize']);
	    }
	    echo json_encode($return);die;
	}
	//上传身份证
	function saveidcard_action(){
	    if(!$_POST['uid']){
	        $data['error']=3;
	        $data['msg']='参数不正确';
	    }else{
	        if($_FILES['photos']['tmp_name']){
	            $UploadM=$this->MODEL('upload');
	            $upload=$UploadM->Upload_pic("../../data/upload/user/",false);
	            $pictures=$upload->picture($_FILES['photos']);
	            $UploadM->picmsg($pictures,$_SERVER['HTTP_REFERER']);
	            $img = str_replace("../../data/upload","./data/upload",$pictures);
	        }
	        if($this->config['user_idcard_status']=="1"){
	            $status=0;
	        }else{
	            $status=1;
	        }
	        $resume=$this->obj->DB_select_once("resume","`uid`='".$_POST['uid']."'");
	        $nid = $this->obj->update_once('resume',array('idcard'=>$_POST['idcard'],'idcard_pic'=>$img,'idcard_status'=>$status),array('uid'=>$_POST['uid']));
	        if($nid){
	            if($resume['idcard_pic'] && (file_exists(str_replace('./',APP_PATH,$resume['idcard_pic'])))){
	                unlink_pic("../.".$resume['idcard_pic']);
	            }
	            $data['error']=1;
	            $data['msg']='上传成功';
	        }else{
	            $data['error']=2;
	            $data['msg']='上传失败';
	        }
	    }
	    echo json_encode($data);die;
	}
	//手机认证,发送短信；
	function mobliecert_action(){
	    if(!$this->config["sy_msguser"] || !$this->config["sy_msgpw"] || !$this->config["sy_msgkey"]||$this->config['sy_msg_isopen']!='1'){
	        $data['error']=10;
	        $data['errmsg']='没有配置短信,请联系管理员';
	        echo json_encode($data);die;
	    }
	    if($this->config['sy_msg_cert']=="2"){
	        $data['error']=11;
	        $data['errmsg']='短信通知已关闭，请联系管理员';
	    }else{
	        $uid = intval($_POST['uid']);
	        $moblie=$_POST['moblie'];
	        $randstr=rand(100000,999999);
	        $num=$this->obj->DB_select_num("moblie_msg","`moblie`='".$moblie."' and `ctime`>'".strtotime('today')."'");
	        if($num>=$this->config['moblie_msgnum']){
	            $data['error']=12;
	            $data['errmsg']='同一手机号一天发送次数已超';
	            echo json_encode($data);die;
	        }
	        $ip=fun_ip_get();
	        $ipnum=$this->obj->DB_select_num("moblie_msg","`ip`='".$ip."' and `ctime`>'".strtotime('today')."'");
	        if($ipnum>=$this->config['ip_msgnum']){
	            $data['error']=13;
	            $data['errmsg']='同一ip一天发送次数已超';
	            echo json_encode($data);die;
	        }
	        $fdata=$this->forsend(array('uid'=>$uid,'usertype'=>1));
	        $data['uid']=$uid;
	        $data['name']=$fdata['name'];
	        $data['type']="cert";
	        $data['moblie']=$moblie;
	        $data['code']=$randstr;
	        $data['date']=date("Y-m-d");
	        $notice = $this->MODEL('notice');
	        $result = $notice->sendSMSType($data);
	        $data['error']=0;
	        if($result['status']=='1'){
	            $sql['status']=0;
	            $sql['step']=1;
	            $sql['check']=$moblie;
	            $sql['check2']=$randstr;
	            $sql['ctime']=time();
	            $row=$this->obj->DB_select_once("company_cert","`uid`='".$uid."' and type='2'");
	            //更新之前认证
	            if(is_array($row)){
	                $where['uid']=$uid;
	                $where['type']='2';
	                $this->obj->update_once("company_cert",$sql,$where);
	                $this->member_log("更新手机认证",$uid,1,13,2);
	            }else{
	                $member=$this->obj->DB_select_once("member","`uid`='".$uid."'","`did`");
	                //添加新认证
	                $sql['uid']=$uid;
	                $sql['did']=$member['did'];
	                $sql['type']=2;
	                $this->obj->insert_into("company_cert",$sql);
	                $this->member_log("添加手机认证",$uid,1,13,1);
	            }
	        }
	    }
	    echo json_encode($data);die;
	}
	function bindingbox_action(){
	    $uid = intval($_POST['uid']);
	    if($_POST['id']=='tel'){
	        $row = $this->obj->DB_select_once("company_cert","`uid`='".$uid."' and `check`='".$_POST['moblie']."'");
	        if($row && is_array($row)){
	            if($row['check2']!=$_POST['code']){
	                $data['error']=10;
	                $data['errmsg']='手机验证码不正确';
	            }else{
	                //清除号码以前认证
	                $this->obj->DB_update_all("resume","`moblie_status`='0',`lastupdate`='".time()."'","`telphone`='".$row['check']."'");
	                $this->obj->DB_update_all("company","`moblie_status`='0'","`linktel`='".$row['check']."'");
	                //清除号码以前认证end
	                $this->obj->DB_update_all("member","`moblie`='".$row['check']."'","`uid`='".$uid."'");
	                $this->obj->DB_update_all("resume","`telphone`='".$row['check']."',`moblie_status`='1'","`uid`='".$uid."'");
	                $this->obj->DB_update_all("company_cert","`status`='1'","`uid`='".$uid."' and `check2`='".$_POST['code']."'");
	                $this->member_log("手机绑定",$uid,2,13,1);
	                $pay=$this->obj->DB_select_once("company_pay","`pay_remark`='手机绑定' and `com_id`='".$uid."'");
	                if(empty($pay)){
	                    $this->MODEL('integral')->get_integral_action($uid,"integral_mobliecert","手机绑定");
	                }
	                $data['error']=0;
	                $data['errmsg']='手机绑定成功';
	            }
	        }else{
	            $data['errmsg']='操作错误';
	        }
	    }elseif ($_POST['id']=='email'){
	        if($this->config['sy_email_set']!="1"){
	            $data['error']=10;
	            $data['errmsg']='邮件没有配置，请联系管理员';
	        }elseif($this->config['sy_email_cert']=="2"){
	            $data['error']=11;
	            $data['errmsg']='邮件通知已关闭，请联系管理员';
	        }else{
	            $email=$_POST['email'];
	            $randstr=rand(10000000,99999999);
	            $sql['status']=0;
	            $sql['step']=1;
	            $sql['check']=$email;
	            $sql['check2']=$randstr;
	            $sql['ctime']=time();
	            $row=$this->obj->DB_select_once("company_cert","`uid`='".$uid."' and type='1'");
	            $member=$this->obj->DB_select_once("member","`uid`='".$uid."'","`did`");
	            if(is_array($row)){//更新之前认证
	                $where['uid']=$uid;
	                $where['type']='1';
	                $this->obj->update_once("company_cert",$sql,$where);
	                $this->member_log("更新邮箱认证",$uid,2,13,2);
	            }else{//添加新认证
	                $sql['uid']=$uid;
	                $sql['did']=$member['did'];
	                $sql['type']=1;
	                $this->obj->insert_into("company_cert",$sql);
	                $this->member_log("添加邮箱认证",$uid,2,13,1);
	            }
	            //发送邮件
	            $base=base64_encode($uid."|".$randstr."|".$this->config['coding']);
	            $fdata=$this->forsend(array('uid'=>$uid,'usertype'=>2));
	            $data['uid']=$uid;
	            $data['name']=$fdata['name'];
	            $data['type']="cert";
	            $data['email']=$email;
	            $url=Url("qqconnect",array('c'=>'cert','id'=>$base),"1");
	            $data['url']="<a href='".$url."'>点击认证</a> 如果您不能在邮箱中直接打开，请复制该链接到浏览器地址栏中直接打开：".$url;
	            $data['date']=date("Y-m-d");
	            $notice = $this->MODEL('notice');
	            $notice->sendEmailType($data);
	            $data['error']=0;
	        }
	    }
	    $row = $this->obj->DB_select_once("company_cert","`uid`='".$uid."' and `check`='".$_POST['moblie']."'");
	    if($row && is_array($row)){
	        if($row['check2']!=$_POST['code']){
	            $data['error']=10;
	            $data['errmsg']='手机验证码不正确';
	        }else{
	            //清除号码以前认证
	            $this->obj->DB_update_all("resume","`moblie_status`='0',`lastupdate`='".time()."'","`telphone`='".$row['check']."'");
	            $this->obj->DB_update_all("company","`moblie_status`='0'","`linktel`='".$row['check']."'");
	            //清除号码以前认证end
	            $this->obj->DB_update_all("member","`moblie`='".$row['check']."'","`uid`='".$uid."'");
	            $this->obj->DB_update_all("resume","`telphone`='".$row['check']."',`moblie_status`='1'","`uid`='".$uid."'");
	            $this->obj->DB_update_all("company_cert","`status`='1'","`uid`='".$uid."' and `check2`='".$_POST['code']."'");
	            $this->member_log("手机绑定",$uid,1,13,1);
	            $pay=$this->obj->DB_select_once("company_pay","`pay_remark`='手机绑定' and `com_id`='".$uid."'");
	            if(empty($pay)){
	                $this->MODEL('integral')->get_integral_action($uid,"integral_mobliecert","手机绑定");
	            }
	            $data['error']=0;
	            $data['errmsg']='手机绑定成功';
	        }
	    }else{
	        $data['errmsg']='操作错误';
	    }
	    echo json_encode($data);die;
	}
	function pwd_action(){
	    $uid = intval($_POST['uid']);
	    $member=$this->obj->DB_select_once("member","`uid`='".$uid."'","`password`,`salt`");
	    $pw=md5(md5($_POST['oldpwd']).$member['salt']);
	    if($pw!=$member['password']){
	        $this->errjson('原密码不正确，请重新输入',10);
	    }else if(mb_strlen($_POST['newpwd'])<6 || mb_strlen($_POST['newpwd'])>20){
	        $this->errjson('密码长度应在6-20位',11);
	    }else if($_POST['newpwd']!=$_POST['confirmpwd']){
	        $this->errjson('新密码和确认密码不一致',12);
	    }else if($this->config['sy_uc_type']=="uc_center" && $member['name_repeat']!="1"){
	        $this->uc_open();
	        $ucresult= uc_user_edit($member['username'], $_POST['oldpwd'], $_POST['newpwd'], "","1");
	        if($ucresult == -1){
	            $this->errjson('旧密码不正确，请重新输入',13);
	        }
	    }else{
	        $salt = substr(uniqid(rand()), -6);
	        $pass = md5(md5($_POST['newpwd']).$salt);
	        $this->obj->DB_update_all("member","`password`='".$pass."',`salt`='".$salt."'","`uid`='".$uid."'");
	        $this->member_log("修改密码",$uid,1,8);
	        $this->errjson('密码修改成功，请重新登录',0);
	    }
	}
	function sysnews_action(){//消息
	    $uid = intval($_POST['uid']);
	    //面试通知
	    $yqrows=$this->obj->DB_select_once("userid_msg","`uid`='".$uid."' order by datetime desc");
	    if($yqrows){
	        $yqrows['datetime'] = date("Y-m-d",$yqrows['datetime']);
	    }
	    $list['yqrows']=$yqrows;
	    $wkyqnum=$this->obj->DB_select_num("userid_msg","`uid`='".$uid."' and `is_browse`='1'");
	    $list['wkyqnum']=$wkyqnum;
	    //私信
	    $sxrows=$this->obj->DB_select_once("sysmsg","`fa_uid`='".$uid."' order by ctime desc");
	    if($sxrows){
	        $sxrows['ctime'] = date("Y-m-d",$sxrows['ctime']);
	        $sxrows['content'] = strip_tags($sxrows['content']);
	    }
	    $list['sxrows']=$sxrows;
	    
	    $sxrowsnum=$this->obj->DB_select_num("sysmsg","`fa_uid`='".$uid."'and `remind_status`='0'");
	    $list['sxrowsnum']=$sxrowsnum;
	    
	    $data['list']=$list;
	    $data['error']=0;
	    echo json_encode($data);die;
	    
	}
	//私信
	function sxnews_action(){
	    $uid = intval($_POST['uid']);
	    $where="`fa_uid`='".$uid."' order by `id` desc limit 100";
	    $rows=$this->obj->DB_select_all("sysmsg",$where);
	    if(is_array($rows)){
	        $patten = array("\r\n", "\n", "\r");
	        foreach($rows as $key=>$value){
	            $ids[]=$value['id'];
	            $rows[$key]['ctime'] = date("Y-m-d",$value['ctime']);
	            $content = strip_tags($value['content']);
	            $content = str_replace('，点击查看公司详情>>', '。', $content);
	            $content = str_replace('。点击查看详情>>', '。', $content);
	            $content = str_replace('，点击查看>>', '。', $content);
	            $rows[$key]['content'] = str_replace($patten, "<br/>", $content);
	            $rows[$key]['remind_status'] = 1;
	            $this->obj->DB_update_all('sysmsg','`remind_status`=1',"`id` in (".pylode(',', $ids).")" );
	        }
	    }
	    $data['list']=count($rows)?$rows:array();
	    $data['error']=0;
	    echo json_encode($data);die;
	}
	function delsxnews_action(){//私信删除
	    $uid = intval($_POST['uid']);
	    if($_POST['id']){
	        $nid = $this->obj->DB_delete_all("sysmsg","`id`='".(int)$_POST['id']."' and `fa_uid`='".$uid."'");
	        if($nid){
	            $this->member_log("删除系统消息",$uid,1,18,3);
	            $data['error']=0;
	            $data['errmsg']='删除成功！';
	        }else{
	            $data['error']=-1;
	            $data['errmsg']='删除失败！';
	        }
	    }
	    $data['error']=0;
	    echo json_encode($data);die;
	}
	function jobcolumn_action(){//职位管理
	    $uid = intval($_POST['uid']);
	    //面试通知
	    $invitenum=$this->obj->DB_select_num("userid_msg","`uid`='".$uid."'");
	    $show['invitenum']=$invitenum;
	    
	    //申请的职位
	    $sqnum=$this->obj->DB_select_num("userid_job","`uid`='".$uid."'");
	    $show['sqnum']=$sqnum;
	    
	    //收藏的职位
	    $collectnum=$this->obj->DB_select_num("fav_job","`uid`='".$uid."'");
	    $show['collectnum']=$collectnum;
	    
	    //关注的企业"atn","`uid`='".$this->uid."' and `sc_usertype`='3'
	    $atncomnum=$this->obj->DB_select_num("atn","`uid`='".$uid."' and `sc_usertype`='2' and (`xjhid`='0' || `xjhid` is NULL)");
	    //$atnltnum=$this->obj->DB_select_num("atn","`uid`='".$uid."' and `sc_usertype`='3'");
	    //$atnacademynum=$this->obj->DB_select_num("atn","`uid`='".$uid."' and `sc_usertype`='5'");
	    //$atnxjhnum=$this->obj->DB_select_num("atn","`uid`='".$uid."' and `sc_usertype`='2'  and `xjhid`!=''");
	    //$atnnum=$atncomnum+$atnltnum+$atnacademynum+$atnxjhnum;
	    $show['atnnum']=$atncomnum;
	    
	    //职位浏览记录
	    $lookjobnum=$this->obj->DB_select_num("look_job","`uid`='".$uid."' and `status`='0'");
	    $show['lookjobnum']=$lookjobnum;
	    
	    //谁看过我的简历
	    $looknum=$this->obj->DB_select_num("look_resume","`uid`='".$uid."'");
	    $show['looknum']=$looknum;
	    
	    $wkyqnum=$this->obj->DB_select_num("userid_msg","`uid`='".$uid."' and `is_browse`=1");
	    $show['wkyqnum']=$wkyqnum;
	    
	    $wlooknum=$this->obj->DB_select_num("look_job","`jobid`='".$uid."' and `status`='0' and `datetime`<time()");
	    $show['wlooknum']=$wlooknum;
	    $data['list']=$show;
	    $data['error']=0;
	    echo json_encode($data);die;
	}
	function atncom_action(){
	    $uid = intval($_POST['uid']);
	    $where="`uid`='".$uid."' order by `time` desc";
	    $rows=$this->obj->DB_Select_all("atn",$where,"`id`,`uid`,`sc_uid`,`time`");
	    if(is_array($rows) && $rows){
	        foreach($rows as $v){
	            $uids[]=$v['sc_uid'];
	        }
	        if($uids){
	            $jobs=$this->obj->DB_select_all("company_job","`uid` in(".pylode(',',$uids).")and `status`<>1","`uid`,`name`,`id`");
	            $company=$this->obj->DB_select_all("company","`uid` in(".pylode(',',$uids).")","`uid`,`name`,`pr`,`mun`,`sdate`");
	            foreach($jobs as $v){
	                $jobname[$v['uid']][]=$v['name'];
	            }
	        }
	        foreach($rows as $key=>$val){
	            $rows[$key]['id']		   =$val['id'];
	            $rows[$key]['uid']		   =$val['uid'];
	            $rows[$key]['sc_uid']		   =$val['sc_uid'];
	            $rows[$key]['time']		   =date("Y-m-d H:i:s",$val['time']);
	            $rows[$key]['type']		   =$val['type'];
	            foreach($company as $v){
	                if($val['sc_uid']==$v['uid']){
	                    $rows[$key]['com_name']=$v['name'];
	                }
	            }
	            foreach($jobname as $k=>$v){
	                if($val['sc_uid']==$k){
	                    $rows[$key]['jobnum']=count($v);
	                    $i=0;
	                    foreach($v as $value){
	                        if($i<2){
	                            $joblist[$key][]=$value;
	                        }
	                        $i++;
	                    }
	                    $rows[$key]['jobname']=@implode(",",$joblist[$key]);
	                }
	            }
	        }
	    }
	    $data['list'] = count($rows)?$rows:array();
	    echo json_encode($data);die;
	}
	//关注或取消关注企业
	function atncompany_action(){
	    $id=(int)$_POST['id'];
	    $uid=(int)$_POST['uid'];
	    if($id>0){
	        if($uid){
	            $atninfo = $this->obj->DB_select_once("atn","`uid`='".$uid."' AND `sc_uid`='".$id."' AND (`xjhid`=0 || `xjhid` is NULL)");
                $company=$this->obj->DB_select_once("company","`uid`='".$id."'","`name`");
                $name = $company['name'];
	            if(is_array($atninfo)&&$atninfo){
	                $this->obj->DB_delete_all("atn","`uid`='".$uid."' AND `sc_uid`='".$id."' AND (`xjhid`=0 || `xjhid` is NULL)");
                    $this->obj->DB_update_all('company',"`ant_num`=`ant_num`-1","`uid`='".$id."'");
                    $this->member_log("取消关注企业信息",$uid,1,5,3);//会员日志
                    $data['errmsg']='取消关注成功！';
                    $data['error'] = 0;
	            }else{
	                $this->obj->DB_insert_once("atn","`uid`='".$uid."',`sc_uid`='".$id."',`usertype`='1',`sc_usertype`='2',`time`='".time()."',`xjhid`=0");
                    $this->obj->DB_update_all('company',"`ant_num`=`ant_num`+1","`uid`='".$id."'");
                    $this->member_log("关注了企业",$uid,1,5,3);//会员日志
                    $data['errmsg']='关注成功！';
                    $data['error'] = 1;
	            }
	        }else{
	            $data['errmsg']='请先登录！';
	            $data['error'] = 10;
	        }
	    }
	    echo json_encode($data);die;
	}
	function delatncom_action(){
	    $uid = intval($_POST['uid']);
	    if($_POST['id']){
	        $id=$this->obj->DB_delete_all("atn","`id`='".(int)$_POST['id']."' and `uid`='".$uid."'");
	        if($id){
	            $this->member_log("取消关注企业信息",$uid,1,5,3);
	            //$this->obj->member_log("取消关注企业信息");
	            $data['errmsg']='取消关注成功！';
	            $data['error'] = 0;
	        }else{
	            $data['errmsg']='取消关注失败！';
	            $data['error'] = 10;
	        }
	    }
	    echo json_encode($data);die;
	}
	function getserver_action(){
	    $uid = intval($_POST['uid']);
	    $eid=$_POST['id'];
	    $expect=$this->obj->DB_select_once("resume_expect","`id`='".$eid."' and `uid`='".$uid."'","`id`,`name`,`topdate`,`doc`");
	    if($expect['doc']==0){
	        $work=$this->obj->DB_select_num("resume_work","`eid`='".$eid."' and `uid`='".$uid."'");
	        if($this->config['user_work_regiser']==1){
	            if($work<1){
	                $this->errjson('你的简历没有工作经历，请添加工作经历',10);
	            }
	        }
	        if($this->config['user_project_regiser']==1){
	            $project=$this->obj->DB_select_num("resume_project","`eid`='".$eid."' and `uid`='".$uid."'");
	            if($project<1){
	                $this->errjson('你的简历没有项目经历，请添加项目经历',11);
	            }
	        }
	        if($this->config['user_edu_regiser']==1){
	            $edu=$this->obj->DB_select_num("resume_edu","`eid`='".$eid."' and `uid`='".$uid."'");
	            if($edu<1){
	                $this->errjson('你的简历没有教育经历，请添加教育经历',12);
	            }
	        }
	    }
	    $info['id']=$expect['id'];
	    $info['name']=$expect['name'];
	    if($expect['topdate']>1){
	        $info['topdate']=date("Y-m-d",$expect['topdate']);
	    }else{
	        $info['topdate']='暂未推广';
	    }
	    
	    $data['info']=$info;
	    $data['webtel']=$this->config['sy_freewebtel'];
	    $data['price']=$this->config['integral_resume_top'];
	    $data['error'] = 0;
	    echo json_encode($data);die;
	}
	function setServer_action(){
	    $getdata=$this->getOpenid($_POST['code']);
	    if($getdata['openid']){
	        $uid = intval($_POST['uid']);
	        $member=$this->obj->DB_select_once("member","`uid` = '".$uid."'","`uid`,`usertype`,`username`,`did`");
	        $data['uid']=$member['uid'];
	        $data['usertype']=$member['usertype'];
	        $data['username']=$member['username'];
	        $data['did']=$member['did'];
	        $data['paytype']='wxpay';
	        $data['resumeid']=$_POST['id'];
	        $data['days']=$_POST['rdays'];
	        $userpayM=$this->MODEL('userpay');
	        $return = $userpayM->buyZdresume($data);
	        $msg="购买简历置顶";
	        if($return['order']['order_id'] && $return['order']['id']){
	            $dingdan = $return['order']['order_id'];
	            $price = $return['order']['order_price'];
	            $id = $return['order']['id'];
	            $this->member_log($msg.",订单ID".$dingdan, $member['uid'], $member['usertype'],88);
                require_once(LIB_PATH.'wxOrder.function.php');
                $data = wxXcxOrder(array('body'=>'充值','id'=>$dingdan,'url'=>$this->config['sy_weburl'],'total_fee'=>$price,'openid'=>$getdata['openid']));
                echo $data;die;
	        }else{
	            $data['errmsg']=$return['error'];
	            echo json_encode($data);die;
	        }
	    }else{
	        if ($getdata['errcode']){
	            $data['errmsg']='出错了，请重试';
	        }else{
	            $data['errmsg']='参数错误';
	        }
	    }
	}
}
?>